Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Need help figuring out how to code this macro
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 |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Need help figuring out how to code this macro
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 |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Need help figuring out how to code this macro
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 |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Need help figuring out how to code this macro
Thanks Ron...it's working great!
"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 |
#5
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA code for macro help | Excel Discussion (Misc queries) | |||
Deleting code from a macro (by a macro) | Excel Discussion (Misc queries) | |||
Macro code | Excel Discussion (Misc queries) | |||
Help With Macro Code?? | Excel Worksheet Functions | |||
Macro VB code help | Excel Discussion (Misc queries) |