View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
jefals jefals is offline
external usenet poster
 
Posts: 3
Default Need help figuring out how to code this macro

I thought about this after I sent my question. I actually divided my
worksheet into 6 smaller sheets since I was running out of columns. So,
while my statement that "Col A always was filled in " is true for the 1st
worksheet, it might not be for some of the others....I was thinking that I
would take Ron's answer and try and figure out how to modify it to reference
Col A of the 1st worksheet -- but it looks like you've saved me the trouble!

Much thanks!,
Jeff S

"Gord Dibben" wrote:

And just in case there were any blanks in Column A

Sub CopyFormula()
Dim lngRowRef As Long
lngRowRef = Range("A" & Rows.Count).End(xlUp).Row
Range("c1").Resize(RowSize:=lngRowRef).Formula = "=EXACT(A1,B1)"
End Sub


Gord Dibben MS Excel MVP

On Sat, 29 Sep 2007 15:14:43 -0400, "Ron Coderre"
wrote:

Try something like this:

Sub CopyFormula()
Dim lngRowRef As Long

lngRowRef = Range("A1").End(xlDown).Row
Range("c1").Resize(RowSize:=lngRowRef).Formula = "=EXACT(A1,B1)"
End Sub

Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)

"jefals" wrote in message
...
Have a worksheet as...
a b c
1 x x =exact(a,b)
2 x
3 x x
4 x x

I'm writing a macro, and want to copy the formula in C1 and paste it,
beginning in C2, and continuing to the last row in the worksheet (in the
example, it would C2 thru C4 ).

I know that Col A will be filled in for each row, so my macro could goto
A1
and do and END-DOWN, to get to the bottom row, but how do I then use this
info in my paste command?

THANKS!,
Jeff