Automate copy and paste

Closed
eleven_607 Posts 2 Registration date Tuesday 28 February 2012 Status Member Last seen 28 February 2012 - 28 Feb 2012 à 02:57
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 25 Mar 2012 à 08:43
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 28 February 2012 Status Member Last seen 28 February 2012
28 Feb 2012 à 06:20
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.
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 766
25 Mar 2012 à 08:43
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?