ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Macro (https://www.excelbanter.com/excel-programming/392122-excel-macro.html)

bobmayers

Excel Macro
 
What commads can I use to test a value in a given cell on a worksheet?

I want to open a secondary worksheet based on the number in a cell.

--
BobMayers

Mike H

Excel Macro
 
Hi,

Try something like this

Sub stantial()
If Range("A1").Value = 1 Then
Path = "C:\"
fname = "Testbook.xls"
Pass = "mypass"
Set mybook = Workbooks.Open(Path & fname, Password:=Pass)
End If
End Sub


Mike

"BobMayers" wrote:

What commads can I use to test a value in a given cell on a worksheet?

I want to open a secondary worksheet based on the number in a cell.

--
BobMayers


bobmayers

Excel Macro
 
Thank you Mike - - but I am not real familier VB I am using 4.0 macro language
have been trying stuff like this
=SET.NAME("MAG1",1)
=SET.NAME("MAG2",2)
=SET.NAME("MAG3",3)
=IF(ABS("RC[11]")=MAG3,ACTIVATE("M3"))
=IF(ABS("RC[11]")=MAG2,ACTIVATE("M2"))
=IF(ABS("RC[11]")=MAG1,ACTIVATE("M1"))

--
BobMayers


"Mike H" wrote:

Hi,

Try something like this

Sub stantial()
If Range("A1").Value = 1 Then
Path = "C:\"
fname = "Testbook.xls"
Pass = "mypass"
Set mybook = Workbooks.Open(Path & fname, Password:=Pass)
End If
End Sub


Mike

"BobMayers" wrote:

What commads can I use to test a value in a given cell on a worksheet?

I want to open a secondary worksheet based on the number in a cell.

--
BobMayers



All times are GMT +1. The time now is 05:26 PM.

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