View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Luke Luke is offline
external usenet poster
 
Posts: 142
Default Run-time error 438 - using With

I'm trying to find out why this code is not working.

With Worksheets("Multi-period Code data").ListBox1
.Clear
For FillCount = 1 To Worksheets("ClassCodes").Range("E1")
.AddItem
Worksheets("ClassCodes").Range("C1").Offset(FillCo unt, 0)
Next FillCount
.ListIndex = Worksheets("Multi-period Code data").Range("O1").Value
End With

Just to clarify, there is a sheet named "Multi-period Code data" and
ListBox1 exists on the sheet. The error appears to be at the initial "With"
statement. I've tried changing it by moving the ".ListBox1" off the first
line and placing it appropriately within the code, but I keep getting
run-time error 438 as soon as it sees the "With" statement.

How can I make this work?