Solved

autofill range to last row in column for specific worksheets

Posted on 2014-02-03
2
358 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 50

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

830 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