Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding formulas to rows using a Loop Macro
I am trying to write a macro that will do the following as long as there is
data in column A. Range("F4").Select ActiveCell.FormulaR1C1 _ = "=IF(LEN(R4C1)<LEN(R4C5), CONCATENATE(R4C1,R4C5),CONCATENATE(R1C5,R1C1))" With Selection.Interior .ColorIndex = 38 .Pattern = xlSolid .PatternColorIndex = xlAutomatic Selection.Locked = True End With How do I write a Loop that will keep doing this on each successive row until the cell in column A is blank? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding formulas to rows using a Loop Macro
Try
Dim R As Range Set R = Range("F4") Do Until R.EntireRow.Cells(1, "A").Value = vbNullString With R .FormulaR1C1 = "your formula here" With .Interior .ColorIndex = 38 .Pattern = xlSolid .PatternColorIndex = xlColorIndexAutomatic End With .Locked = True End With Set R = R(2, 1) Loop Cordially, Chip Pearson Microsoft MVP 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com [email on web site] On Mon, 25 Jan 2010 15:08:01 -0800, Lucas B wrote: I am trying to write a macro that will do the following as long as there is data in column A. Range("F4").Select ActiveCell.FormulaR1C1 _ = "=IF(LEN(R4C1)<LEN(R4C5), CONCATENATE(R4C1,R4C5),CONCATENATE(R1C5,R1C1))" With Selection.Interior .ColorIndex = 38 .Pattern = xlSolid .PatternColorIndex = xlAutomatic Selection.Locked = True End With How do I write a Loop that will keep doing this on each successive row until the cell in column A is blank? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding formulas to rows using a Loop Macro
Please disregard, I've gotten an answer to this question.
"Lucas B" wrote: I am trying to write a macro that will do the following as long as there is data in column A. Range("F4").Select ActiveCell.FormulaR1C1 _ = "=IF(LEN(R4C1)<LEN(R4C5), CONCATENATE(R4C1,R4C5),CONCATENATE(R1C5,R1C1))" With Selection.Interior .ColorIndex = 38 .Pattern = xlSolid .PatternColorIndex = xlAutomatic Selection.Locked = True End With How do I write a Loop that will keep doing this on each successive row until the cell in column A is blank? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding formulas after rows | Excel Discussion (Misc queries) | |||
Adding formulas after rows | Excel Discussion (Misc queries) | |||
Adding rows in between formulas | Excel Worksheet Functions | |||
Adding and deleting rows with formulas ****Need Help**** | Excel Discussion (Misc queries) | |||
adding new rows and keeping same formulas | Excel Discussion (Misc queries) |