ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook Path (https://www.excelbanter.com/excel-programming/286282-workbook-path.html)

Todd Huttenstine[_2_]

Workbook Path
 
I need a code that will say:

If Workbook located in P:\QTD\Stats Manager.xls Worksheets
(4).Range("A1")=1 then msgbox "Upgrade" else msgbox "No
Upgrade"


How would I do this?

Thanx

Todd Huttenstine

Ron de Bruin

Workbook Path
 
Hi Todd

You can open the file with VBA and check the value.
With screenupdating to false it is fast and you don't see the file open and close.

Or use John's example to check a value in a closed file
http://j-walk.com/ss/excel/tips/tip82.htm



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Todd Huttenstine" wrote in message ...
I need a code that will say:

If Workbook located in P:\QTD\Stats Manager.xls Worksheets
(4).Range("A1")=1 then msgbox "Upgrade" else msgbox "No
Upgrade"


How would I do this?

Thanx

Todd Huttenstine




Rob van Gelder[_4_]

Workbook Path
 
Sub testit()
Dim wkb As Workbook

Set wkb = Workbooks.Open(Filename:="P:\QTD\Stats Manager.xls",
ReadOnly:=True)
If wkb.Worksheets(4).Range("A1") = 1 Then MsgBox "Upgrade" Else MsgBox
"No Upgrade"
wkb.Close SaveChange:=False
End Sub


"Todd Huttenstine" wrote in message
...
I need a code that will say:

If Workbook located in P:\QTD\Stats Manager.xls Worksheets
(4).Range("A1")=1 then msgbox "Upgrade" else msgbox "No
Upgrade"


How would I do this?

Thanx

Todd Huttenstine




Todd Htutenstine

Workbook Path
 
The workbook cannot be opened to check it.
-----Original Message-----
Sub testit()
Dim wkb As Workbook

Set wkb = Workbooks.Open(Filename:="P:\QTD\Stats

Manager.xls",
ReadOnly:=True)
If wkb.Worksheets(4).Range("A1") = 1 Then

MsgBox "Upgrade" Else MsgBox
"No Upgrade"
wkb.Close SaveChange:=False
End Sub


"Todd Huttenstine"

wrote in message
...
I need a code that will say:

If Workbook located in P:\QTD\Stats Manager.xls

Worksheets
(4).Range("A1")=1 then msgbox "Upgrade" else msgbox "No
Upgrade"


How would I do this?

Thanx

Todd Huttenstine



.


J.E. McGimpsey

Workbook Path
 
Take a look at John Walkenbach's

A VBA Function to Get a Value From a Closed File
http://j-walk.com/ss/excel/tips/tip82.htm

it should be able to be adapted for your needs.

In article ,
"Todd Htutenstine" wrote:

The workbook cannot be opened to check it.
-----Original Message-----
Sub testit()
Dim wkb As Workbook

Set wkb = Workbooks.Open(Filename:="P:\QTD\Stats

Manager.xls",
ReadOnly:=True)
If wkb.Worksheets(4).Range("A1") = 1 Then

MsgBox "Upgrade" Else MsgBox
"No Upgrade"
wkb.Close SaveChange:=False
End Sub


"Todd Huttenstine"

wrote in message
...
I need a code that will say:

If Workbook located in P:\QTD\Stats Manager.xls

Worksheets
(4).Range("A1")=1 then msgbox "Upgrade" else msgbox "No
Upgrade"


How would I do this?

Thanx

Todd Huttenstine


Harald Staff

Workbook Path
 
Hi Todd

Another approach might be to use a free cell, enter a formula in it pointing to the
file/sheet/cell, calculate, remove the formula. Something like:

Sub GetTheThing()
On Error GoTo None
Sheets(1).Cells(1, 1).FormulaR1C1 = _
"='P:\QTD\[Stats Manager.xls]Sheet4'!R1C1"
Sheets(1).Cells(1, 1).Calculate
Sheets(1).Cells(1, 1).Value = _
Sheets(1).Cells(1, 1).Value
If Sheets(1).Cells(1, 1).Value = 1 Then
MsgBox "Upgrade"
Exit Sub
End If
None:
MsgBox "Never upgrade"
End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"Todd Huttenstine" wrote in message
...
I need a code that will say:

If Workbook located in P:\QTD\Stats Manager.xls Worksheets
(4).Range("A1")=1 then msgbox "Upgrade" else msgbox "No
Upgrade"


How would I do this?

Thanx

Todd Huttenstine





All times are GMT +1. The time now is 06:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com