ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Coding problem (https://www.excelbanter.com/excel-programming/439708-coding-problem.html)

jazzzbo

Coding problem
 
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

ryguy7272

Coding problem
 
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)


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"jazzzbo" wrote:

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
.


TomPl

Coding problem
 
Try this:

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

Tom

"jazzzbo" wrote:

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
.



All times are GMT +1. The time now is 05:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com