ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   variable in application line (https://www.excelbanter.com/excel-programming/429024-variable-application-line.html)

Nev

variable in application line
 
I use the line below in part of my spreadsheets.

Application.Goto Reference:=Range("'addresses'" & "!a1")

Range("B7").Select

I would like to use this elsewhere where 'addresses' is a variable

ie It would pick up whatever is in sheet "info" F30 and take me to the
relevant sheet

How can I do this?

thanks

Nev

Jacob Skaria

variable in application line
 
Dim rngTemp As Range
Set rngTemp = Sheets("Sheet2").Range("A1")
Application.Goto Reference:=rngTemp

If this post helps click Yes
---------------
Jacob Skaria


"Nev" wrote:

I use the line below in part of my spreadsheets.

Application.Goto Reference:=Range("'addresses'" & "!a1")

Range("B7").Select

I would like to use this elsewhere where 'addresses' is a variable

ie It would pick up whatever is in sheet "info" F30 and take me to the
relevant sheet

How can I do this?

thanks

Nev


Nev

variable in application line
 
Jacob

Thanks for the quick reply. Sorry - I want to use whatever is in "Info F30"
as the variable. Therefore if "Info F30" said May it would take me to
worksheet "May", Sept to worksheet "September" etc

Thanks

nev


"Jacob Skaria" wrote:

Dim rngTemp As Range
Set rngTemp = Sheets("Sheet2").Range("A1")
Application.Goto Reference:=rngTemp

If this post helps click Yes
---------------
Jacob Skaria


"Nev" wrote:

I use the line below in part of my spreadsheets.

Application.Goto Reference:=Range("'addresses'" & "!a1")

Range("B7").Select

I would like to use this elsewhere where 'addresses' is a variable

ie It would pick up whatever is in sheet "info" F30 and take me to the
relevant sheet

How can I do this?

thanks

Nev


Jacob Skaria

variable in application line
 
Dim strSheet as String
strSheet = Sheets("info").Range("F30")
Sheets(strSheet).Activate

OR

Dim strSheet as String
strSheet = Sheets("info").Range("F30")
Application.Goto Reference:=Sheets(strSheet).Range("A1")

--
If this post helps click Yes
---------------
Jacob Skaria


"Nev" wrote:

Jacob

Thanks for the quick reply. Sorry - I want to use whatever is in "Info F30"
as the variable. Therefore if "Info F30" said May it would take me to
worksheet "May", Sept to worksheet "September" etc

Thanks

nev


"Jacob Skaria" wrote:

Dim rngTemp As Range
Set rngTemp = Sheets("Sheet2").Range("A1")
Application.Goto Reference:=rngTemp

If this post helps click Yes
---------------
Jacob Skaria


"Nev" wrote:

I use the line below in part of my spreadsheets.

Application.Goto Reference:=Range("'addresses'" & "!a1")

Range("B7").Select

I would like to use this elsewhere where 'addresses' is a variable

ie It would pick up whatever is in sheet "info" F30 and take me to the
relevant sheet

How can I do this?

thanks

Nev



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

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