View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default read excel worksheet

set rng = worksheets(2).Range("A1").CurrentRegion
set rng = rng.offset(1,0).Resize(rng.rows.count-1,1)
for each cell in rng
msgbox "Office: " & cell.Value & vbNewLine & _
"City: " & cell.offset(0,1).Value & vbNewLine & _
"Address: " & cell.offset(0,2).Value
Next

--
Regards,
Tom Ogilvy


"microsoft.news.com" <CSharpCoder wrote in message
...
I have an excel file with 3 worksheets that i'm using as a database. How

can
I read a particular worksheet and get those values out of the cells?

Example:

Sheet1
Name State Address
John PA
Sally DE


Sheet2
Office City Address
Main Campus Philly
Select Baltimore

How can I get the values from Sheet2 only?