Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
Solver - error - Compile Error Nina Excel Discussion (Misc queries) 0 August 19th 08 09:41 PM
help with this error-Compile error: cant find project or library JackR Excel Discussion (Misc queries) 2 June 10th 06 09:09 PM
VBA Error Message "Compile Error...." Steve Excel Discussion (Misc queries) 3 July 15th 05 09:20 AM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM


All times are GMT +1. The time now is 11:09 AM.

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"