Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default Macro to Copy and Paste to all worksheets after a point.

I posted this question, but in a rather more long winded way yesterday but
was hoping for an answer if i word it a little more simply. Essentially, I
need to design a macro to Copy information from a worksheet and paste to
other worsksheets after this point - but not necessarily worksheets with a
fixed name or to ALL other worksheets after it.

I can do it to worksheets with fixed names - something like

Sheets("Mon").Select
Cells.Select
Selection.Copy
Sheets("Tues").Select
Cells.Select
ActiveSheet.Paste


I'm just after some tips to make this more flexible. For instance, looking
at the above example, I may want to copy to all sheets that begin with "Tues
........"

I realise I can copy and paste manually but for my needs, thats not
particularly useful - this need to be a command button that updates other
sheets quickly if information in one sheet is changed.

I suppose I'm not looking for a definitve answer, just some tips and
pointers - my excel knowldege is good, but programming not so!!!!

Thanks in advance for any help!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro to Copy and Paste to all worksheets after a point.

Ther2 arre two methods for specifying sheet in a macro


ShtArray = Array("sheet1","Sheet5",Sheet8")
for each sht in ShtArray
with sheets(sht)

end with
next sht


for each sht in sheets
if left(sht.name,3) = "Tue" then

end if
next sht


Which method you use depends on the number of sheets and the filter you are
using to pick the sheets. A common approach is something like this

for each sht in sheets
if sht.name < "Master" then

end if
next sht


"Terry" wrote:

I posted this question, but in a rather more long winded way yesterday but
was hoping for an answer if i word it a little more simply. Essentially, I
need to design a macro to Copy information from a worksheet and paste to
other worsksheets after this point - but not necessarily worksheets with a
fixed name or to ALL other worksheets after it.

I can do it to worksheets with fixed names - something like

Sheets("Mon").Select
Cells.Select
Selection.Copy
Sheets("Tues").Select
Cells.Select
ActiveSheet.Paste


I'm just after some tips to make this more flexible. For instance, looking
at the above example, I may want to copy to all sheets that begin with "Tues
......."

I realise I can copy and paste manually but for my needs, thats not
particularly useful - this need to be a command button that updates other
sheets quickly if information in one sheet is changed.

I suppose I'm not looking for a definitve answer, just some tips and
pointers - my excel knowldege is good, but programming not so!!!!

Thanks in advance for any help!!!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Macro to Copy and Paste to all worksheets after a point.

Hey Terry, i would try and set a loop, something like

for each WrkSht in thisworkbook.worksheets
if wrksht.name = "blah" then
goto mynext
else
What you want to copy i.e. sheet1.range("D2:D5").copy
where you want to paste it i.e.
wrksht.name.range("D2:D5").pastespecial
end if

mynext:
nextwrksht

have a play and get it do what you want. HTH pal

The Noob.

"Terry" wrote:

I posted this question, but in a rather more long winded way yesterday but
was hoping for an answer if i word it a little more simply. Essentially, I
need to design a macro to Copy information from a worksheet and paste to
other worsksheets after this point - but not necessarily worksheets with a
fixed name or to ALL other worksheets after it.

I can do it to worksheets with fixed names - something like

Sheets("Mon").Select
Cells.Select
Selection.Copy
Sheets("Tues").Select
Cells.Select
ActiveSheet.Paste


I'm just after some tips to make this more flexible. For instance, looking
at the above example, I may want to copy to all sheets that begin with "Tues
......."

I realise I can copy and paste manually but for my needs, thats not
particularly useful - this need to be a command button that updates other
sheets quickly if information in one sheet is changed.

I suppose I'm not looking for a definitve answer, just some tips and
pointers - my excel knowldege is good, but programming not so!!!!

Thanks in advance for any help!!!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default Macro to Copy and Paste to all worksheets after a point.

Thanks guys, some useful advice there. I;m going to have a crack at it and
see if i can get it working!!!

"Noob McKnownowt" wrote:

Hey Terry, i would try and set a loop, something like

for each WrkSht in thisworkbook.worksheets
if wrksht.name = "blah" then
goto mynext
else
What you want to copy i.e. sheet1.range("D2:D5").copy
where you want to paste it i.e.
wrksht.name.range("D2:D5").pastespecial
end if

mynext:
nextwrksht

have a play and get it do what you want. HTH pal

The Noob.

"Terry" wrote:

I posted this question, but in a rather more long winded way yesterday but
was hoping for an answer if i word it a little more simply. Essentially, I
need to design a macro to Copy information from a worksheet and paste to
other worsksheets after this point - but not necessarily worksheets with a
fixed name or to ALL other worksheets after it.

I can do it to worksheets with fixed names - something like

Sheets("Mon").Select
Cells.Select
Selection.Copy
Sheets("Tues").Select
Cells.Select
ActiveSheet.Paste


I'm just after some tips to make this more flexible. For instance, looking
at the above example, I may want to copy to all sheets that begin with "Tues
......."

I realise I can copy and paste manually but for my needs, thats not
particularly useful - this need to be a command button that updates other
sheets quickly if information in one sheet is changed.

I suppose I'm not looking for a definitve answer, just some tips and
pointers - my excel knowldege is good, but programming not so!!!!

Thanks in advance for any help!!!

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 to copy & paste-special-values data to selected worksheets tomhelle Excel Discussion (Misc queries) 1 May 5th 10 02:00 PM
Copy & paste macro for multiple worksheets tomhelle Excel Discussion (Misc queries) 8 March 15th 10 06:21 PM
copy paste problems for chart from excel to power point, solution Jean Charts and Charting in Excel 3 March 3rd 07 03:09 AM
copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro Steven Excel Programming 1 October 17th 05 08:56 AM
Copy and Paste between 2 worksheets with VBA Dave Y Excel Worksheet Functions 2 June 15th 05 03:47 PM


All times are GMT +1. The time now is 09:18 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"