Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compile Error
When I use the following code I receive an error message
that says Compile Error: Statements and labels invalid between Select Case and first Case. The word QA is highlighted in yellow after the word Set. What am I missing or what am I doing incorrectly? Your time is appreciated. Private Sub Up1_Click() Select Case LB1.ListIndex Dim QA As Worksheet Dim SourceRows As Variant Dim DestRows As Variant Dim I As Long Set QA = Worksheets("QA" & LB1.ListIndex + 1) SourceRows = Array(6, 9, 11, 12, 13, 14, 16) DestRows = Array(13, 14, 31, 49, 78, 96, 114) Range("C5").Value = QA.Range("B4").Value Range("C6").Value = QA.Range("E4").Value For I = LBound(SourceRows) To Unbound(SourceRows) 'copy all 12 cells from source row column D 'to destination row column C Cells(DestRows(I), "C").Resize(1, 12).Value = QA.Cells (SourceRows(I), "D").Resize(1, 12).Value Next I End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error Cont....
It is Ubound, not Unbound
Regards, Tom Ogilvy "Markus" wrote in message ... Thanks for all your help. I deleted the Select case line from the command. Although now when the the command is run i get a new compile error. Sub or Function not Defined. With the highlight on the word Unbound -----Original Message----- You don't need the select case. If I left it in there, it was an omission to not delete it Private Sub Up1_Click() Dim QA As Worksheet Dim SourceRows As Variant Dim DestRows As Variant Dim I As Long Set QA = Worksheets("QA" & LB1.ListIndex + 1) SourceRows = Array(6, 9, 11, 12, 13, 14, 16) DestRows = Array(13, 14, 31, 49, 78, 96, 114) Range("C5").Value = QA.Range("B4").Value Range("C6").Value = QA.Range("E4").Value For I = LBound(SourceRows) To Unbound(SourceRows) 'copy all 12 cells from source row column D 'to destination row column C Cells(DestRows(I), "C").Resize(1, 12).Value = _ QA.Cells(SourceRows(I), "D").Resize(1, 12).Value Next I End Sub -- Regards, Tom Ogilvy "Markus" wrote in message ... When I use the following code I receive an error message that says Compile Error: Statements and labels invalid between Select Case and first Case. The word QA is highlighted in yellow after the word Set. What am I missing or what am I doing incorrectly? Your time is appreciated. Private Sub Up1_Click() Select Case LB1.ListIndex Dim QA As Worksheet Dim SourceRows As Variant Dim DestRows As Variant Dim I As Long Set QA = Worksheets("QA" & LB1.ListIndex + 1) SourceRows = Array(6, 9, 11, 12, 13, 14, 16) DestRows = Array(13, 14, 31, 49, 78, 96, 114) Range("C5").Value = QA.Range("B4").Value Range("C6").Value = QA.Range("E4").Value For I = LBound(SourceRows) To Unbound(SourceRows) 'copy all 12 cells from source row column D 'to destination row column C Cells(DestRows(I), "C").Resize(1, 12).Value = QA.Cells (SourceRows(I), "D").Resize(1, 12).Value Next I End Sub . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Solver - error - Compile Error | Excel Discussion (Misc queries) | |||
help with this error-Compile error: cant find project or library | Excel Discussion (Misc queries) | |||
VBA Error Message "Compile Error...." | Excel Discussion (Misc queries) | |||
How do I get rid of "Compile error in hidden module" error message | Excel Discussion (Misc queries) |