ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofill (https://www.excelbanter.com/excel-programming/290677-autofill.html)

Carmela[_2_]

Autofill
 
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

Colo

Autofill
 
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:

------------------------------------------------------------------


"Carmela" wrote in message
om...
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




All times are GMT +1. The time now is 06:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com