Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Marcro to copy and paste a formula
I want to write a macro that copies and pastes a formula down column A, but I
want it to stop where column B equals "Grand Total". Can anyone help with this? -- Thank you, Jodie |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Marcro to copy and paste a formula
Try
lngRow = Columns(2).Find("Grand Total").Row - 1 Range("A1:A" & lngRow).Formula = "=B1+C1" If this post helps click Yes --------------- Jacob Skaria "Jodie" wrote: I want to write a macro that copies and pastes a formula down column A, but I want it to stop where column B equals "Grand Total". Can anyone help with this? -- Thank you, Jodie |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Marcro to copy and paste a formula
Jodie,
It would have helped if you told us what formula but this should point you in the right direction Sub Sonic() r = Cells.Find(What:="Grand total", After:=Range("B1"), LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Row Range("a1").Formula = "=B1" Range("A1:A" & r).FillDown Range("A5").Select End Sub Mike "Jodie" wrote: I want to write a macro that copies and pastes a formula down column A, but I want it to stop where column B equals "Grand Total". Can anyone help with this? -- Thank you, Jodie |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Marcro to copy and paste a formula
Sorry Mike, this is what I was using. I didn't know how to make it end at
"Grand Total". Sub InsertPLANIDinCOL() ' Columns("A:A").Select Selection.Insert Shift:=xlToRight Range("A1").Select ActiveCell.FormulaR1C1 = "=RC[1]" Range("A2").Select ActiveCell.FormulaR1C1 = _ "=IF(R[-1]C[1]=""Grand Total"","""",IF(RC[1]="""",R[-1]C,RC[1]))" Range("A2").Select Selection.Copy Range(Selection, Selection.End(xlDown)).Select ActiveSheet.Paste End Sub -- Thank you, Jodie "Mike H" wrote: Jodie, It would have helped if you told us what formula but this should point you in the right direction Sub Sonic() r = Cells.Find(What:="Grand total", After:=Range("B1"), LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Row Range("a1").Formula = "=B1" Range("A1:A" & r).FillDown Range("A5").Select End Sub Mike "Jodie" wrote: I want to write a macro that copies and pastes a formula down column A, but I want it to stop where column B equals "Grand Total". Can anyone help with this? -- Thank you, Jodie |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Marcro to copy and paste a formula
Thank you Jacob, this worked for me.
Mike, I will try yours out as well to see which works best for my project. -- Thank you, Jodie "Jacob Skaria" wrote: Try lngRow = Columns(2).Find("Grand Total").Row - 1 Range("A1:A" & lngRow).Formula = "=B1+C1" If this post helps click Yes --------------- Jacob Skaria "Jodie" wrote: I want to write a macro that copies and pastes a formula down column A, but I want it to stop where column B equals "Grand Total". Can anyone help with this? -- Thank you, Jodie |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel formula to copy/paste formula needed please. | Excel Discussion (Misc queries) | |||
can't copy/paste the formula | Excel Discussion (Misc queries) | |||
Copy / Paste Formula | Excel Discussion (Misc queries) | |||
Copy/Paste how to avoid the copy of formula cells w/o calc values | Excel Discussion (Misc queries) | |||
Marcro to copy sheet out of workbook | Excel Programming |