Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Chris E.
 
Posts: n/a
Default Macro with Range of Worksheets

This is probably simple to do, but I don't do this enough to know.

How would I edit this macro to paste to a range of 134 worksheets that are
after two that I do not want to paste to. In this example I have gone to
each worksheet and pasted one at a time.

Range("G14").Select
Selection.Copy
Sheets("2").Select
Range("G14").Select
ActiveSheet.Paste
Sheets("3").Select
Range("G14").Select
ActiveSheet.Paste
Sheets("4").Select
Range("G14").Select
ActiveSheet.Paste
  #6   Report Post  
JE McGimpsey
 
Posts: n/a
Default

One way:

If you're trying to copy from sheet "1" to Sheet "4" and subsequent
sheets, and they're in order:

Public Sub CopySkipPaste()
Dim rCopy As Range
Dim i As Long
Set rCopy = Sheets("1").Range("G14")
For i = 4 to Worksheets.Count
rCopy.Copy Destination:=Sheets(i).Range("G14")
Next i
End Sub


In article ,
"Chris E." <Chris wrote:

This is probably simple to do, but I don't do this enough to know.

How would I edit this macro to paste to a range of 134 worksheets that are
after two that I do not want to paste to. In this example I have gone to
each worksheet and pasted one at a time.

Range("G14").Select
Selection.Copy
Sheets("2").Select
Range("G14").Select
ActiveSheet.Paste
Sheets("3").Select
Range("G14").Select
ActiveSheet.Paste
Sheets("4").Select
Range("G14").Select
ActiveSheet.Paste

  #7   Report Post  
Chris E.
 
Posts: n/a
Default

Bingo. Thank you

"JE McGimpsey" wrote:

One way:

If you're trying to copy from sheet "1" to Sheet "4" and subsequent
sheets, and they're in order:

Public Sub CopySkipPaste()
Dim rCopy As Range
Dim i As Long
Set rCopy = Sheets("1").Range("G14")
For i = 4 to Worksheets.Count
rCopy.Copy Destination:=Sheets(i).Range("G14")
Next i
End Sub


In article ,
"Chris E." <Chris wrote:

This is probably simple to do, but I don't do this enough to know.

How would I edit this macro to paste to a range of 134 worksheets that are
after two that I do not want to paste to. In this example I have gone to
each worksheet and pasted one at a time.

Range("G14").Select
Selection.Copy
Sheets("2").Select
Range("G14").Select
ActiveSheet.Paste
Sheets("3").Select
Range("G14").Select
ActiveSheet.Paste
Sheets("4").Select
Range("G14").Select
ActiveSheet.Paste


  #8   Report Post  
Don Guillett
 
Posts: n/a
Default

Sub selectsheetindex()
'Sheets(1).Select 'gets 1st in line
Sheet1.Select 'gets index number
End Sub


The macro must be put in a regular module vs a sheet module. It WILL take
the value of whatever is in cell a1 of the sheet from where executed (sheet
1 or 2 would be nice) and place in all but the 1st two sheets based on where
they are in the workbook. The 1st 2 tabs. So, it assumed you would have
11111 in cell a1 of sheet 1 and execute the macro from that sheet. Now that
sheet and the next one will not be changed but all the others will.

Send your email to my email and I will send you a sample workbook where it
works.


--
Don Guillett
SalesAid Software

"Chris E." <Chris wrote in message
...
I cannot get this to work.

"Don Guillett" wrote:

That IS the macro

--
Don Guillett
SalesAid Software

"Chris E." <Chris wrote in message
...
I don't understand where to put this in the macro.

"Don Guillett" wrote:

try this idea

Sub copytosheets()
For i = 3 To Sheets.Count
Sheets(i).Range("a1") = Range("a1")
Next
End Sub

--
Don Guillett
SalesAid Software

"Chris E." <Chris wrote in message
...
This is probably simple to do, but I don't do this enough to know.

How would I edit this macro to paste to a range of 134 worksheets

that
are
after two that I do not want to paste to. In this example I have

gone
to
each worksheet and pasted one at a time.

Range("G14").Select
Selection.Copy
Sheets("2").Select
Range("G14").Select
ActiveSheet.Paste
Sheets("3").Select
Range("G14").Select
ActiveSheet.Paste
Sheets("4").Select
Range("G14").Select
ActiveSheet.Paste








Reply
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
Macro does not run when data refreshed Larry Lehman Excel Discussion (Misc queries) 0 January 16th 05 07:31 PM
HELP! How do you--> Lock a set of rows but also link worksheets to FRUSTRATED Excel Discussion (Misc queries) 6 December 29th 04 10:05 PM
named range refers to: in a chart Spencer Hutton Excel Discussion (Misc queries) 1 December 14th 04 10:15 PM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM
Macro for Show/Hide Range Bill Excel Discussion (Misc queries) 3 December 1st 04 05:33 PM


All times are GMT +1. The time now is 01:32 PM.

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

About Us

"It's about Microsoft Excel"