Xl Macro To Count Consecutive Rows of Data Starting From Specific Cell

ggelineau

Board Regular
Joined
May 24, 2005
Messages
69
I recorded a macro that will be used to reformat a spreadsheet every day. The spreadsheet to be reformatted is always consistent except in terms of the amount of rows of data, which causes a problem for my macro since I need to insert formulas into cells within row thirteen and then copy those formulas down to the last row of data.

The titles for the Data always start in Cell A12, so the data will always start in Cell A13 and go from there. There are some rows of miscellaneous information below the data (there are blank cells between the data and this misc. information) so I will need to count, starting at A13, the amount of rows that contain data without interruption (i.e. no blanks).

I will then need to enter the count as the row number in a bunch of statements similar to the one below, where I entered a formula on the 13th row and then copied it down to the last row.

Range("D13").Select
Selection.AutoFill Destination:=Range("D13:D??")

I am truly stumped on how to not only create the count code but also how to go about adding the count so that it is accepted as the row number within the code above.

Any help is much appreciate.

Thanks,
G
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Try

Code:
Dim lr As Long
lr = Range("A" & Rows.Count).End(xlUp).Row
Range("D13").AutoFill Destination:=Range("D13:D" & lr)
 
Upvote 0
Try:

Code:
Dim LastRow as Long
LastRow = Range("A13").End(xlDown).Row
Range("D13").AutoFill Destination:=Range("D13:D" & LastRow)
 
Upvote 0
will copy D13 to all rows in D untils such time as a blank appears below A13.

Code:
Dim rng As Range
Set rng = Range(Cells(13, 4), Cells(13, 1).End(xlDown).Offset(0, 3))
Cells(13, 4).AutoFill Destination:=rng
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,568
Members
448,972
Latest member
Shantanu2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top