Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copying specific cell ranges from a worksheet multiple times to a newsheet

Here is what I have:

I have a workbook with multiple worksheets. Each worksheet corresponds to a certain store fixture estimate. Ont these sheets I have a specific cell where you can input how many fixtures of that type are to be used.

On that sheet also, is a range of cells (ex. Range("A65:F3340")) that needs to be copied to a new summations sheet of total hours to build the project.

If sheet 1 has 1 fixture - the macro should copy the range of cells only once.
Sheet 2 has 4 fixtures - tha macro should copy the same range four times appending each set of data tot eh end of the previous, And so on for each fixture sheet.

How would I write a macro to do this? I can provide a sample workbook if needed. Thanks.

EggHeadCafe - Software Developer Portal of Choice
VIsual Studio.NET 2005 ClickOnce Technology: An Overview
http://www.eggheadcafe.com/tutorials...t-2005-cl.aspx
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Copying specific cell ranges from a worksheet multiple times to a new sheet

This assumes that the range containing the items is A2:A20. You can change
that to the actual range. Also change the sheet names to the actual sheets
used.

Sub GetBOM()
Dim rng As Range, sh1 As Worksheet, sh2 As Worksheet
Set sh1 = ActiveSheet
Set sh2 = Sheets("Sheet2") 'Change as required
Set rng = sh1.Range("A2:A20")
mult = Application.InputBox("Enter the quantity of fixtures", _
"FIXTURE QTY", Type:=1)
For i = 1 To mult
x = sh2.Cells(Rows.Count, 1).End(xlUp).Offset(2).Address
rng.Copy sh2.Range(x)
Next
End Sub




<Kris Winntech wrote in message ...
Here is what I have:

I have a workbook with multiple worksheets. Each worksheet corresponds to
a certain store fixture estimate. Ont these sheets I have a specific cell
where you can input how many fixtures of that type are to be used.

On that sheet also, is a range of cells (ex. Range("A65:F3340")) that
needs to be copied to a new summations sheet of total hours to build the
project.

If sheet 1 has 1 fixture - the macro should copy the range of cells only
once.
Sheet 2 has 4 fixtures - tha macro should copy the same range four times
appending each set of data tot eh end of the previous, And so on for each
fixture sheet.

How would I write a macro to do this? I can provide a sample workbook if
needed. Thanks.

EggHeadCafe - Software Developer Portal of Choice
VIsual Studio.NET 2005 ClickOnce Technology: An Overview
http://www.eggheadcafe.com/tutorials...t-2005-cl.aspx



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copying specific cell ranges from a worksheet multiple times to anew sheet

How would I loop this to make it work for all sheets in the workbook?



JLGWhiz wrote:

This assumes that the range containing the items is A2:A20.
09-Nov-09

This assumes that the range containing the items is A2:A20. You can change
that to the actual range. Also change the sheet names to the actual sheets
used.

Sub GetBOM()
Dim rng As Range, sh1 As Worksheet, sh2 As Worksheet
Set sh1 = ActiveSheet
Set sh2 = Sheets("Sheet2") 'Change as required
Set rng = sh1.Range("A2:A20")
mult = Application.InputBox("Enter the quantity of fixtures", _
"FIXTURE QTY", Type:=1)
For i = 1 To mult
x = sh2.Cells(Rows.Count, 1).End(xlUp).Offset(2).Address
rng.Copy sh2.Range(x)
Next
End Sub

Previous Posts In This Thread:

EggHeadCafe - Software Developer Portal of Choice
Working with Client Side Xml Data Islands from Server-Side ASP.NET code
http://www.eggheadcafe.com/tutorials...ient-side.aspx
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Copying specific cell ranges from a worksheet multiple times to a new sheet


If there is a constant cell on each sheet that
indicates the number of fixtures for that sheet,
you could also eliminate the input box by making
mult = that cell value. Otherwise you are stuck
with the input box. I did not test this revision,
but it should go through all the sheets in the
active workbook. Again, change sheet names and range
references to actual.

Sub GetBOM()
Dim rng As Range, sh1 As Worksheet, sh2 As Worksheet
For Each sh1 In ThisWorkbook.Sheets
If sh1.Name < "Sheet2" 'To ignore if is summation sheet
Set sh2 = Sheets("Sheet2") 'Change as required
Set rng = sh1.Range("A2:A20")
mult = Application.InputBox("Enter the quantity of fixtures", _
"FIXTURE QTY", Type:=1)
For i = 1 To mult
x = sh2.Cells(Rows.Count, 1).End(xlUp).Offset(2).Address
rng.Copy sh2.Range(x)
Next
End If
Next
End Sub



<Kris Winntech wrote in message ...
How would I loop this to make it work for all sheets in the workbook?



JLGWhiz wrote:

This assumes that the range containing the items is A2:A20.
09-Nov-09

This assumes that the range containing the items is A2:A20. You can
change
that to the actual range. Also change the sheet names to the actual
sheets
used.

Sub GetBOM()
Dim rng As Range, sh1 As Worksheet, sh2 As Worksheet
Set sh1 = ActiveSheet
Set sh2 = Sheets("Sheet2") 'Change as required
Set rng = sh1.Range("A2:A20")
mult = Application.InputBox("Enter the quantity of fixtures", _
"FIXTURE QTY", Type:=1)
For i = 1 To mult
x = sh2.Cells(Rows.Count, 1).End(xlUp).Offset(2).Address
rng.Copy sh2.Range(x)
Next
End Sub

Previous Posts In This Thread:

EggHeadCafe - Software Developer Portal of Choice
Working with Client Side Xml Data Islands from Server-Side ASP.NET code
http://www.eggheadcafe.com/tutorials...ient-side.aspx



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
Copying Cell from Multiple Worksheets to a Summary Worksheet shel Excel Worksheet Functions 4 January 14th 09 08:03 PM
How do I force entry in multiple cell ranges in one worksheet CindyB Excel Worksheet Functions 0 July 10th 08 06:08 PM
Protection - multiple ranges at different times PurpleMilk Excel Worksheet Functions 0 May 13th 08 12:05 AM
copying cell info from one worksheet to another based on a specific date [email protected] Excel Programming 8 November 16th 06 03:31 PM
How to send specific cell ranges to multiple e-mail addresses Meghan Excel Programming 0 October 16th 06 06:14 PM


All times are GMT +1. The time now is 02:06 AM.

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"