Coding problem

J

jazzzbo

Would someone please show me what is the correct way to code the
following so that my AutoFill Destination goes from Cells(27,2) to
Cells(27,numberofRows)?


ws1.Range("A2").Select
numberofRows = ActiveCell.CurrentRegion.Rows.Count

Selection.AutoFill Destination:=ws1.Range("AA2:AA822"),
Type:=xlFillDefault

Thanks,
Jim Berglund
 
R

ryguy7272

So you want to fill down in Column B, based on stuff in Column A?

Dim lastrow As Long
lastrow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
Range("B2").AutoFill Range("B2:B" & lastrow)
 
T

tompl

Try this:

ws1.Range("A2").Select
numberofRows =
ActiveCell.CurrentRegion.Rows(ActiveCell.CurrentRegion.Rows.Count).Row
ws1.Range("AA2").AutoFill Destination:=Range("AA2:AA" & numberofRows),
Type:=xlFillDefault

Tom
 

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