Autofill

  • Thread starter Thread starter Carmela
  • Start date Start date
C

Carmela

Hi,

I`m trying to create a macro that ranges the above 5 rows and columns
(A to D) no matter where I am on the worksheet and then autofill down
to 1 row down.
Then I want it to insert a row down and do 10 above rows and columns
(a to d).

Can anyone please help me with this.

I hope I have explained my self clearly - I just don`t know how to
explain it.

-got to know where I am in the worksheet
-range the above 5 rows colums a to d
-then fill 1 row down
-insert a row (down)
- then do the same procedure but 10 rows up and then all over again.

Thanks
 
Hi Carmela

You can know where you are in the worksheet with Activecell property.

Dim lngR As Long
lngR = ActiveCell.Row
Range(Cells(lngR - 5, "A"), Cells(lngR - 1, "E")).Select

Regarding to other things, I think Recording macro shows you the code.

HTH

--
Kind Regards
Colo ------------------------------------------------------------------
Masaru Kaji (aka Colo) Office Systems - Excel MSMVP(2004-2005)

Web site: Colo's Excel Junk Room
http://www.interq.or.jp/sun/puremis/colo/

Email: (e-mail address removed)
 
Back
Top