Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jas Jas is offline
external usenet poster
 
Posts: 42
Default Summary Sheet from range specified in a worksheet

Hi,

I have used Ron de Bruins code for creating a summary spreadsheet but I need
to modify it so that it refers to a range that is specified in a worksheet
rather than in the macro. The reason for this is that fields may need to be
added or removed, depending on user requirements and I need to give them that
flexibility (also they wont mess with the code that way either).

Does anyone know how I can move that part of the code to look at a
spreadsheet values instead? The code is:


'The links to the first sheet will start in row 2
RwNum = 1

For Each Sh In Basebook.Worksheets
If Sh.Name < Newsh1.Name And Sh.Visible And Sh.Name Like ("DT - *")
Then
ColNum = 1
RwNum = RwNum + 1
'Copy the sheet name in the A column
Newsh1.Cells(RwNum, 1).Value = Sh.Name

For Each myCell In
Sh.Range("B1,C79,D79,H79,I79,C80,D80,H80,I80,C84,D 84,H84,I84,C81,D81,H81,I81,C82,D82,H82,I82,C83,D83 ,H83,I83,C85,D85,H85,I85,c16,d16,h16,i16,D85,I55,c 94,D94,H94,I94,d55,h97,h98,h99,h100,h101,h102") '<--Change the Range
ColNum = ColNum + 1
Newsh1.Cells(RwNum, ColNum).Formula = "='" & Sh.Name & "'!"
& myCell.Address(False, False)
Next myCell

End If
Next Sh

Thanks in advance!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Summary Sheet from range specified in a worksheet

I think I understnad your question. The data in the RANGE(Text String) is a
text string.

Sh.Range("B1,C79,D79,H79,I79,C80,D80,H80,I80," & _
"C84,D84,H84,I84,C81,D81,H81,I81,C82," & _
"D82,H82,I82,C83,D83,H83,I83,C85,D85," & _
"H85,I85,c16,d16,h16,i16,D85,I55,c94," & _
"D94,H94,I94,d55,h97,h98,h99,h100,h101,h102")

You could also do the same using a worksheet
Sh.Range(range("A1").value)

where A1 contains the string
"B1,C79,D79,H79,I79,C80,D80,H80,I80," & _
"C84,D84,H84,I84,C81,D81,H81,I81,C82," & _
"D82,H82,I82,C83,D83,H83,I83,C85,D85," & _
"H85,I85,c16,d16,h16,i16,D85,I55,c94," & _
"D94,H94,I94,d55,h97,h98,h99,h100,h101,h102"

"Jas" wrote:

Hi,

I have used Ron de Bruins code for creating a summary spreadsheet but I need
to modify it so that it refers to a range that is specified in a worksheet
rather than in the macro. The reason for this is that fields may need to be
added or removed, depending on user requirements and I need to give them that
flexibility (also they wont mess with the code that way either).

Does anyone know how I can move that part of the code to look at a
spreadsheet values instead? The code is:


'The links to the first sheet will start in row 2
RwNum = 1

For Each Sh In Basebook.Worksheets
If Sh.Name < Newsh1.Name And Sh.Visible And Sh.Name Like ("DT - *")
Then
ColNum = 1
RwNum = RwNum + 1
'Copy the sheet name in the A column
Newsh1.Cells(RwNum, 1).Value = Sh.Name

For Each myCell In
Sh.Range("B1,C79,D79,H79,I79,C80,D80,H80,I80,C84,D 84,H84,I84,C81,D81,H81,I81,C82,D82,H82,I82,C83,D83 ,H83,I83,C85,D85,H85,I85,c16,d16,h16,i16,D85,I55,c 94,D94,H94,I94,d55,h97,h98,h99,h100,h101,h102") '<--Change the Range
ColNum = ColNum + 1
Newsh1.Cells(RwNum, ColNum).Formula = "='" & Sh.Name & "'!"
& myCell.Address(False, False)
Next myCell

End If
Next Sh

Thanks in advance!

  #3   Report Post  
Posted to microsoft.public.excel.programming
Jas Jas is offline
external usenet poster
 
Posts: 42
Default Summary Sheet from range specified in a worksheet

Thanks Joel. Is there a way to have these values in A1:10 and loop it through
those values?


"Joel" wrote:

I think I understnad your question. The data in the RANGE(Text String) is a
text string.

Sh.Range("B1,C79,D79,H79,I79,C80,D80,H80,I80," & _
"C84,D84,H84,I84,C81,D81,H81,I81,C82," & _
"D82,H82,I82,C83,D83,H83,I83,C85,D85," & _
"H85,I85,c16,d16,h16,i16,D85,I55,c94," & _
"D94,H94,I94,d55,h97,h98,h99,h100,h101,h102")

You could also do the same using a worksheet
Sh.Range(range("A1").value)

where A1 contains the string
"B1,C79,D79,H79,I79,C80,D80,H80,I80," & _
"C84,D84,H84,I84,C81,D81,H81,I81,C82," & _
"D82,H82,I82,C83,D83,H83,I83,C85,D85," & _
"H85,I85,c16,d16,h16,i16,D85,I55,c94," & _
"D94,H94,I94,d55,h97,h98,h99,h100,h101,h102"

"Jas" wrote:

Hi,

I have used Ron de Bruins code for creating a summary spreadsheet but I need
to modify it so that it refers to a range that is specified in a worksheet
rather than in the macro. The reason for this is that fields may need to be
added or removed, depending on user requirements and I need to give them that
flexibility (also they wont mess with the code that way either).

Does anyone know how I can move that part of the code to look at a
spreadsheet values instead? The code is:


'The links to the first sheet will start in row 2
RwNum = 1

For Each Sh In Basebook.Worksheets
If Sh.Name < Newsh1.Name And Sh.Visible And Sh.Name Like ("DT - *")
Then
ColNum = 1
RwNum = RwNum + 1
'Copy the sheet name in the A column
Newsh1.Cells(RwNum, 1).Value = Sh.Name

For Each myCell In
Sh.Range("B1,C79,D79,H79,I79,C80,D80,H80,I80,C84,D 84,H84,I84,C81,D81,H81,I81,C82,D82,H82,I82,C83,D83 ,H83,I83,C85,D85,H85,I85,c16,d16,h16,i16,D85,I55,c 94,D94,H94,I94,d55,h97,h98,h99,h100,h101,h102") '<--Change the Range
ColNum = ColNum + 1
Newsh1.Cells(RwNum, ColNum).Formula = "='" & Sh.Name & "'!"
& myCell.Address(False, False)
Next myCell

End If
Next Sh

Thanks in advance!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Summary Sheet from range specified in a worksheet

It would be the same as your original code

for each cell in Sh.Range(range("A1").value)
'enter your code here
next cell

"Jas" wrote:

Thanks Joel. Is there a way to have these values in A1:10 and loop it through
those values?


"Joel" wrote:

I think I understnad your question. The data in the RANGE(Text String) is a
text string.

Sh.Range("B1,C79,D79,H79,I79,C80,D80,H80,I80," & _
"C84,D84,H84,I84,C81,D81,H81,I81,C82," & _
"D82,H82,I82,C83,D83,H83,I83,C85,D85," & _
"H85,I85,c16,d16,h16,i16,D85,I55,c94," & _
"D94,H94,I94,d55,h97,h98,h99,h100,h101,h102")

You could also do the same using a worksheet
Sh.Range(range("A1").value)

where A1 contains the string
"B1,C79,D79,H79,I79,C80,D80,H80,I80," & _
"C84,D84,H84,I84,C81,D81,H81,I81,C82," & _
"D82,H82,I82,C83,D83,H83,I83,C85,D85," & _
"H85,I85,c16,d16,h16,i16,D85,I55,c94," & _
"D94,H94,I94,d55,h97,h98,h99,h100,h101,h102"

"Jas" wrote:

Hi,

I have used Ron de Bruins code for creating a summary spreadsheet but I need
to modify it so that it refers to a range that is specified in a worksheet
rather than in the macro. The reason for this is that fields may need to be
added or removed, depending on user requirements and I need to give them that
flexibility (also they wont mess with the code that way either).

Does anyone know how I can move that part of the code to look at a
spreadsheet values instead? The code is:


'The links to the first sheet will start in row 2
RwNum = 1

For Each Sh In Basebook.Worksheets
If Sh.Name < Newsh1.Name And Sh.Visible And Sh.Name Like ("DT - *")
Then
ColNum = 1
RwNum = RwNum + 1
'Copy the sheet name in the A column
Newsh1.Cells(RwNum, 1).Value = Sh.Name

For Each myCell In
Sh.Range("B1,C79,D79,H79,I79,C80,D80,H80,I80,C84,D 84,H84,I84,C81,D81,H81,I81,C82,D82,H82,I82,C83,D83 ,H83,I83,C85,D85,H85,I85,c16,d16,h16,i16,D85,I55,c 94,D94,H94,I94,d55,h97,h98,h99,h100,h101,h102") '<--Change the Range
ColNum = ColNum + 1
Newsh1.Cells(RwNum, ColNum).Formula = "='" & Sh.Name & "'!"
& myCell.Address(False, False)
Next myCell

End If
Next Sh

Thanks in advance!

  #5   Report Post  
Posted to microsoft.public.excel.programming
Jas Jas is offline
external usenet poster
 
Posts: 42
Default Summary Sheet from range specified in a worksheet

Thanks Joel. What I ended up doing is setting another variable (myrng) as the
range that I needed to refer to ("A1:A100") and ran the rest of the code
normally. Quite simple when someone else tells you the answer!! Thanks once
again.

Jas

"Joel" wrote:

It would be the same as your original code

for each cell in Sh.Range(range("A1").value)
'enter your code here
next cell

"Jas" wrote:

Thanks Joel. Is there a way to have these values in A1:10 and loop it through
those values?


"Joel" wrote:

I think I understnad your question. The data in the RANGE(Text String) is a
text string.

Sh.Range("B1,C79,D79,H79,I79,C80,D80,H80,I80," & _
"C84,D84,H84,I84,C81,D81,H81,I81,C82," & _
"D82,H82,I82,C83,D83,H83,I83,C85,D85," & _
"H85,I85,c16,d16,h16,i16,D85,I55,c94," & _
"D94,H94,I94,d55,h97,h98,h99,h100,h101,h102")

You could also do the same using a worksheet
Sh.Range(range("A1").value)

where A1 contains the string
"B1,C79,D79,H79,I79,C80,D80,H80,I80," & _
"C84,D84,H84,I84,C81,D81,H81,I81,C82," & _
"D82,H82,I82,C83,D83,H83,I83,C85,D85," & _
"H85,I85,c16,d16,h16,i16,D85,I55,c94," & _
"D94,H94,I94,d55,h97,h98,h99,h100,h101,h102"

"Jas" wrote:

Hi,

I have used Ron de Bruins code for creating a summary spreadsheet but I need
to modify it so that it refers to a range that is specified in a worksheet
rather than in the macro. The reason for this is that fields may need to be
added or removed, depending on user requirements and I need to give them that
flexibility (also they wont mess with the code that way either).

Does anyone know how I can move that part of the code to look at a
spreadsheet values instead? The code is:


'The links to the first sheet will start in row 2
RwNum = 1

For Each Sh In Basebook.Worksheets
If Sh.Name < Newsh1.Name And Sh.Visible And Sh.Name Like ("DT - *")
Then
ColNum = 1
RwNum = RwNum + 1
'Copy the sheet name in the A column
Newsh1.Cells(RwNum, 1).Value = Sh.Name

For Each myCell In
Sh.Range("B1,C79,D79,H79,I79,C80,D80,H80,I80,C84,D 84,H84,I84,C81,D81,H81,I81,C82,D82,H82,I82,C83,D83 ,H83,I83,C85,D85,H85,I85,c16,d16,h16,i16,D85,I55,c 94,D94,H94,I94,d55,h97,h98,h99,h100,h101,h102") '<--Change the Range
ColNum = ColNum + 1
Newsh1.Cells(RwNum, ColNum).Formula = "='" & Sh.Name & "'!"
& myCell.Address(False, False)
Next myCell

End If
Next Sh

Thanks in advance!

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
Automatically add a column to summary sheet if another worksheet i Living Design Excel Worksheet Functions 2 May 5th 09 12:58 AM
Make all values of a 3D named range appear on summary sheet Joe L Excel Discussion (Misc queries) 1 April 14th 09 10:33 PM
Copy Several named Range in many sheets to a summary sheet Frank Situmorang Excel Programming 8 May 10th 07 09:14 AM
summary data sheet from worksheet to worksheet KKay Excel Worksheet Functions 1 May 21st 06 10:37 AM
Summarize multiple worksheet detail on summary sheet 061931 Excel Discussion (Misc queries) 6 May 23rd 05 02:09 PM


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