Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code for macro help Cam Excel Discussion (Misc queries) 0 September 7th 07 07:14 PM
Deleting code from a macro (by a macro) Brettjg Excel Discussion (Misc queries) 2 May 8th 07 10:14 PM
Macro code Shu of AZ Excel Discussion (Misc queries) 2 January 29th 07 06:29 PM
Help With Macro Code?? Neil Smith Excel Worksheet Functions 1 August 24th 06 07:40 PM
Macro VB code help Anthony Excel Discussion (Misc queries) 4 October 8th 05 07:25 PM


All times are GMT +1. The time now is 01:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"