Solved

autofill range to last row in column for specific worksheets

Posted on 2014-02-03
2
354 Views
Last Modified: 2014-02-03
Hello,

I have a number of active worksheets in Wb"A". I would like the macro to run for specific worksheets named, Sheet1, Sheet4, Sheet8.

In each named sheet, the macro should fill down the columns D-H to the last row in Column A, starting at the last row in Columns D-H.

e.g. if the last row in column A is 200 and the last row in Columns D-H is 150, then the macro should fill down D150-H200.

The macro should then repeat for all the named sheets in the workbook.

Thanks,
CC
0
Comment
Question by:CC10
2 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 400 total points
ID: 39829425
Hi,

pls try

Sub Macro()
aShts = Array("Sheet1", "Sheet4")
For Each sht In aShts
Sheets(sht).Activate
LastRowA = Range("A" & Cells.Rows.Count).End(xlUp).Row
LastRowD = Range("D" & Cells.Rows.Count).End(xlUp).Row
Range("D" & LastRowD & ":H" & LastRowA).FillDown
Next
End Sub 

Open in new window

Regards
0
 

Author Closing Comment

by:CC10
ID: 39829679
Perfect. Thanks vm.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Excel VBA - copying formats 7 22
Oart.dll 2 30
Copy the formula in excel 8 31
Formula to copy cell and its "format" 3 26
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now