Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
For each next choking.
Greetings,
Here is my problem I have code similar to the following Dim theSheet as WorkSheet For each theSheet in thisWorkBook Do some code... next theSheet It runs the first iteration fine, but the second iteration gives me a runtime error "type mismatch". What I have discovered, is the second sheet is a chart. I've moved the chart and the choke time changes, so I know that is an issue with the chart. But I need to know what I can do to correct this. Any help in pointing me in the right direction would be greatly appreciated. And anyone who just plain gives me the right answer I'll name my first born after ;-). Thanks, Jim |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
For each next choking.
use thisworkbook.worksheets
in the for loop Keith www.kjtfs.co -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
For each next choking.
Hi
one way: Dim theSheet as WorkSheet For each theSheet in thisWorkBook.worksheets Do some code... next theSheet -- Regards Frank Kabel Frankfurt, Germany Jim Chandler wrote: Greetings, Here is my problem I have code similar to the following Dim theSheet as WorkSheet For each theSheet in thisWorkBook Do some code... next theSheet It runs the first iteration fine, but the second iteration gives me a runtime error "type mismatch". What I have discovered, is the second sheet is a chart. I've moved the chart and the choke time changes, so I know that is an issue with the chart. But I need to know what I can do to correct this. Any help in pointing me in the right direction would be greatly appreciated. And anyone who just plain gives me the right answer I'll name my first born after ;-). Thanks, Jim |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
For each next choking.
Try this
Dim theSheet As Worksheet For Each theSheet In ThisWorkbook.Worksheets 'Do some code... Next theSheet -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Jim Chandler" wrote in message ... Greetings, Here is my problem I have code similar to the following Dim theSheet as WorkSheet For each theSheet in thisWorkBook Do some code... next theSheet It runs the first iteration fine, but the second iteration gives me a runtime error "type mismatch". What I have discovered, is the second sheet is a chart. I've moved the chart and the choke time changes, so I know that is an issue with the chart. But I need to know what I can do to correct this. Any help in pointing me in the right direction would be greatly appreciated. And anyone who just plain gives me the right answer I'll name my first born after ;-). Thanks, Jim |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
For each next choking.
-----Original Message----- Try this Dim theSheet As Worksheet For Each theSheet In ThisWorkbook.Worksheets 'Do some code... Next theSheet -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Jim Chandler" wrote in message ... Greetings, Here is my problem I have code similar to the following Dim theSheet as WorkSheet For each theSheet in thisWorkBook Do some code... next theSheet It runs the first iteration fine, but the second iteration gives me a runtime error "type mismatch". What I have discovered, is the second sheet is a chart. I've moved the chart and the choke time changes, so I know that is an issue with the chart. But I need to know what I can do to correct this. Any help in pointing me in the right direction would be greatly appreciated. And anyone who just plain gives me the right answer I'll name my first born after ;-). Thanks, Jim . Okay - My mistake, I transposed (right word?) the code wrong it is actually "thisworkbook.worksheets" Jim |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
For each next choking.
Hi Jim
Show your other code Jim that is in this sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Jim Chandler" wrote in message ... -----Original Message----- Try this Dim theSheet As Worksheet For Each theSheet In ThisWorkbook.Worksheets 'Do some code... Next theSheet -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Jim Chandler" wrote in message ... Greetings, Here is my problem I have code similar to the following Dim theSheet as WorkSheet For each theSheet in thisWorkBook Do some code... next theSheet It runs the first iteration fine, but the second iteration gives me a runtime error "type mismatch". What I have discovered, is the second sheet is a chart. I've moved the chart and the choke time changes, so I know that is an issue with the chart. But I need to know what I can do to correct this. Any help in pointing me in the right direction would be greatly appreciated. And anyone who just plain gives me the right answer I'll name my first born after ;-). Thanks, Jim . Okay - My mistake, I transposed (right word?) the code wrong it is actually "thisworkbook.worksheets" Jim |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
For each next choking.
Here is the code in it's entirety. I just copied and
pasted it so I hope you can read it. Public Sub ComputeRollups() Dim theSheet As Worksheet Dim sum As Integer, numSummed As Integer Dim theRow As Integer, theCol As Integer Dim temp As String For Each theSheet In ThisWorkbook.Sheets If (theSheet.Name < "survey tracking" And theSheet.Name < "Chart1" And theSheet.Name < "CIO sector response" And theSheet.Name < "Yellow & Red Metrics") Then For theRow = 5 To 36 sum = 0 If theRow = 10 Or theRow = 16 Or theRow = 21 Or theRow = 27 Or theRow = 32 Then 'skip row Else theCol = 4 sum = 0 Count = 0 Do While UCase$(theSheet.Cells(2, theCol - 1).Value) < "ROLL-UP VALUE" If UCase$(theSheet.Cells(1, theCol - 1).Value) < "HQ Average" Then temp = theSheet.Cells(2, theCol - 1).Value If theSheet.Cells(theRow, theCol).Value 0 Then sum = sum + theSheet.Cells (theRow, theCol).Value Count = Count + 1 End If End If theCol = theCol + 2 Loop theSheet.Cells(theRow, theCol - 1).Value = CDbl(sum) / Count End If Next theRow End If Next theSheet End Sub -----Original Message----- Hi Jim Show your other code Jim that is in this sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Jim Chandler" wrote in message ... -----Original Message----- Try this Dim theSheet As Worksheet For Each theSheet In ThisWorkbook.Worksheets 'Do some code... Next theSheet -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Jim Chandler" wrote in message ... Greetings, Here is my problem I have code similar to the following Dim theSheet as WorkSheet For each theSheet in thisWorkBook Do some code... next theSheet It runs the first iteration fine, but the second iteration gives me a runtime error "type mismatch". What I have discovered, is the second sheet is a chart. I've moved the chart and the choke time changes, so I know that is an issue with the chart. But I need to know what I can do to correct this. Any help in pointing me in the right direction would be greatly appreciated. And anyone who just plain gives me the right answer I'll name my first born after ;-). Thanks, Jim . Okay - My mistake, I transposed (right word?) the code wrong it is actually "thisworkbook.worksheets" Jim . |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
For each next choking.
Well - I figured out the difference of what I had and what
you posted. It's Worksheets, not Sheets. Thanks for putting up with my synaptic overload. Jim -----Original Message----- Hi Jim Show your other code Jim that is in this sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Jim Chandler" wrote in message ... -----Original Message----- Try this Dim theSheet As Worksheet For Each theSheet In ThisWorkbook.Worksheets 'Do some code... Next theSheet -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Jim Chandler" wrote in message ... Greetings, Here is my problem I have code similar to the following Dim theSheet as WorkSheet For each theSheet in thisWorkBook Do some code... next theSheet It runs the first iteration fine, but the second iteration gives me a runtime error "type mismatch". What I have discovered, is the second sheet is a chart. I've moved the chart and the choke time changes, so I know that is an issue with the chart. But I need to know what I can do to correct this. Any help in pointing me in the right direction would be greatly appreciated. And anyone who just plain gives me the right answer I'll name my first born after ;-). Thanks, Jim . Okay - My mistake, I transposed (right word?) the code wrong it is actually "thisworkbook.worksheets" Jim . |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
For each next choking.
I see it Jim
-- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Jim Chandler" wrote in message ... Well - I figured out the difference of what I had and what you posted. It's Worksheets, not Sheets. Thanks for putting up with my synaptic overload. Jim -----Original Message----- Hi Jim Show your other code Jim that is in this sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Jim Chandler" wrote in message ... -----Original Message----- Try this Dim theSheet As Worksheet For Each theSheet In ThisWorkbook.Worksheets 'Do some code... Next theSheet -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Jim Chandler" wrote in message ... Greetings, Here is my problem I have code similar to the following Dim theSheet as WorkSheet For each theSheet in thisWorkBook Do some code... next theSheet It runs the first iteration fine, but the second iteration gives me a runtime error "type mismatch". What I have discovered, is the second sheet is a chart. I've moved the chart and the choke time changes, so I know that is an issue with the chart. But I need to know what I can do to correct this. Any help in pointing me in the right direction would be greatly appreciated. And anyone who just plain gives me the right answer I'll name my first born after ;-). Thanks, Jim . Okay - My mistake, I transposed (right word?) the code wrong it is actually "thisworkbook.worksheets" Jim . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|