Automate copy and paste

Closed
eleven_607 Posts 2 Registration date Tuesday February 28, 2012 Status Member Last seen February 28, 2012 - Feb 28, 2012 at 02:57 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Mar 25, 2012 at 08:43 AM
Hello,

I need your help in excel macro, i want to automate a simple task of copying and pasting formula on cell "A2:B2" until to last cell beside column C which is not blank or empty.

Ex I have a data on worksheet named "raw", and on column C until C258 and I want to paste the formula on A2:B2 until A258:B258 but my data on column C changes from time to time so I having a hard time to automatically copy and paste the formula.

I know you can help me with this, im still trying to learn macros.



2 responses

eleven_607 Posts 2 Registration date Tuesday February 28, 2012 Status Member Last seen February 28, 2012
Feb 28, 2012 at 06:20 AM
Sub Convert_USD()

Sheets("QA raw").Activate
Range("A2:B2").Select
Application.CutCopyMode = False
Selection.Copy

'I get lost starting here, as I cannot select the needed range, range should be selected until...

lMaxRows = Cells(Rows.Count, "C").End(xlUp).Row
Range("C" & lMaxRows + -1).Select
Selection.Offset(1, -2).Select

.... from A3:B3 and then paste special formulas'

Selection.pastespecial paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

Calculate

End Sub

Please help.

Thanks a lot in advance.
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Mar 25, 2012 at 08:43 AM
Are you saying you have two formulas, one one A2 and one on B2 and you would like to copy the same formula down in column A and Column B for all available rows?
0