Dim cells in a sheet as a range

C

Corey

I am using a Select Case statement, and instead of having many Case
statements to cover ALL cell senarios, how can i use a line to 'DIM" an
array of cells?

Rather than something like:

Case Is = Sheet4.range("A1")
' code 1

Case Is = Sheet4.range("C3")
' code 2
Case Is = Sheet4.range("H10")
' code 3 etc............

How can i use some thing like:
Dim sh as Sheet4
Dim rng as Range
Set rng = sh.Cells("A1,C3,H10,...........")

Case Select Sheet1.range("D2").value
Case sh.rng
' code to work for ALL rng senario's....
end Select


How can i Syntax this?
 
C

Corey

Select Case UserForm1.ComboBox2
Case Is = Range("WorkShopRates") ' <= = Named range
MsgBox "W/Shop"
Case Is = Range("SiteRates") ' <= = Named range
MsgBox "Site"
End Select

Works

I think thus far anyhow


Corey....
 
R

Rick Rothstein \(MVP - VB\)

What you can do depends on how similar or different code1, code2, code3,
etc. are. Can you give us some insight into what you are doing here?

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top