View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Patti[_2_] Patti[_2_] is offline
external usenet poster
 
Posts: 36
Default Rows & Cols - copy formulas in Col A to # rows in Col B

One way:



lstRow = Range("B" & Rows.Count).End(xlUp).Row



Range("A2").Formula = "= YOUR FORMULA IN QUOTES HERE"



Set sourceRange = Worksheets("YOUR SHEET NAME").Range("A2")

Set fillRange = Worksheets("YOUR SHEET NAME").Range("A2:A" & lstRow)

sourceRange.AutoFill Destination:=fillRange

'convert formula to value

Columns("A:A").Value = Columns("A:A").Value


HTH,

Patti

"Mikey" wrote in message
...
I need to insert formulas in Col A along side unknown # rows of data in Col
B
but can't seem to get the coding correct.
ie: Col B has continuous data in B3:B45 ; how do I enter a formula in A3
and using Range(Selection, Selection.End(xlToRight)).Select and/or
Range(Selection, Selection.End(xlDown)).Select
get the highlighted range to show A3:A45?
Using Range(Selection, Selection.Offset(0,-1)).Select give me 3 Cols
highlighted.
Suggestions?
Also what about when Col B doesn't have contiuous data in the rows? How
do
I determine and highlight the appropriate number of rows in Col A?
Thanks

--
Mikey