Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a command button placed at the end of the first 40 rows o
Sheet1. When pushed, the button inserts an equation into about different cells on that particular row, copies the cells, and paste the values only. In the next row down, the same equations are pasted, copied and value pasted. Is it possible to copy-down the VB Code so that I do not have to kee duplicating and changing it all the way down to row 500. The onl updates in the macro are subtracting 1 from [R] in each of th equations. Each row that I move down and put a command button, subtract 1 from the [R] value. Sub CalculateRow12() Range("K12").Select ActiveCell.FormulaR1C1 = "=PollutantSummaries!R[-5]C[-9]" Range("N12").Select ActiveCell.FormulaR1C1 = "=PollutantSummaries!R[15]C[-6]" Range("O12").Select ActiveCell.FormulaR1C1 = "=PollutantSummaries!R[3]C[-7]" Range("P12").Select ActiveCell.FormulaR1C1 = "=PollutantSummaries!R[5]C[-8]" Range("Q12").Select ActiveCell.FormulaR1C1 = "=PollutantSummaries!R[2]C[-9]" Range("W12").Select ActiveCell.FormulaR1C1 = "=PollutantSummaries!R[29]C[-15]" Range("X12").Select ActiveCell.FormulaR1C1 = "=PollutantSummaries!R[31]C[-16]" Range("Z12").Select ActiveCell.FormulaR1C1 = "=PollutantSummaries!R[30]C[-18]" Range("AA12").Select ActiveCell.FormulaR1C1 = "=PollutantSummaries!R[32]C[-19]" Range("K12:R12").Select Selection.Copy Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone SkipBlanks:= _ False, Transpose:=False Range("V12:Z12").Select Application.CutCopyMode = False Selection.Copy Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone SkipBlanks:= _ False, Transpose:=False Application.CutCopyMode = False Range("K12").Select End Su -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy cell by command button | Excel Worksheet Functions | |||
copy the command button and macro for multiple rows | Excel Discussion (Misc queries) | |||
Using Command Button to copy cells | Excel Discussion (Misc queries) | |||
copy & paste command button | Excel Programming | |||
copy and delete command button | Excel Programming |