LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy down command button

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy cell by command button kalpesh Excel Worksheet Functions 1 December 28th 11 08:41 PM
copy the command button and macro for multiple rows bigproblem Excel Discussion (Misc queries) 6 April 5th 09 09:46 PM
Using Command Button to copy cells Pennington Excel Discussion (Misc queries) 1 April 29th 05 02:30 AM
copy & paste command button RENEE RINEHART Excel Programming 4 April 9th 04 06:10 AM
copy and delete command button Mark Kubicki Excel Programming 0 October 6th 03 08:20 PM


All times are GMT +1. The time now is 02:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"