Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
will i be able to run a query against it like what you have below?
currently i'm just doing "select office , city, address from A1:C100" and this gives me all the data within that range, but I only have 1 sheet in there now. But the actual exel document i'll be using will have the 3. So I need to query the frist sheet, the 2nd sheet and the 3rd sheet to get different data and then combine them into one file. "Tom Ogilvy" wrote in message ... 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? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
[Sheet2$] is used to identify the "table"
disregard my code. You previously said nothing about querying a sheet. -- Regards, Tom Ogilvy "NuB" <CSharpCoder wrote in message ... will i be able to run a query against it like what you have below? currently i'm just doing "select office , city, address from A1:C100" and this gives me all the data within that range, but I only have 1 sheet in there now. But the actual exel document i'll be using will have the 3. So I need to query the frist sheet, the 2nd sheet and the 3rd sheet to get different data and then combine them into one file. "Tom Ogilvy" wrote in message ... 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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I print worksheet, that is read only? | Excel Discussion (Misc queries) | |||
How do I print worksheet, that is read only? | Excel Discussion (Misc queries) | |||
Read worksheet in excel | Excel Worksheet Functions | |||
How to read Excel worksheet with Excel Reader | Excel Discussion (Misc queries) | |||
Can I set up a worksheet as read only for one user | Excel Programming |