Solved

autofill range to last row in column for specific worksheets

Posted on 2014-02-03
2
356 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 49

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Remove duplicates using cell values VBA 2 29
Data in Rows to be converted into single row 9 40
Office 2016 without internet 6 36
Excel formula Sumif not working 4 28
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 …
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
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…

776 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