Automatic range adjustment when copying data

S

Sandeman

Excel experts...

I have two worksheets in my workbook, one of which goes to a maste
worksheet and selects a range of cells. The macro I use is:

ActiveCell.FormulaR1C1 = "=Dates!RC"
Range("A2").Select
Selection.AutoFill Destination:=Range("A2:A500")
Type:=xlFillDefault
Range("A2:A500").Select

I use a range from 2 to 500 because the information rarely exceeds 50
cells. How can I have the macro go to the main worksheet and onl
collect what data is there rather than just 500 rows of data, most o
which I don't use and look ugly in the worksheet.

Many thanks for your help. This site and the people on it is a savior
 
G

Guest

Dim rng as Range
With Worksheets("Dates")
set rng = .Range(.Cells(2,1),.Cells(2,1).End(xldown))
End with
with Worksheets("Master")
.Range(rng.Address).FormulaR1C1 = "=Dates!RC"
end with
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top