VBA to "Goto" WS and locate the referenced cell

SeliM

Board Regular
Joined
Aug 10, 2023
Messages
51
Office Version
  1. 365
Platform
  1. Windows
Good morning,
Thank you for taking time to read my enquiry.

I have a formula using address and match to form an address - e.g. 'Weighting Table'!$B$8 on the Check Text worksheet
I would like a macro that uses the address 'Weighting Table'!$B$8 in Check Text WS to go cell B8 on the Weighting Table WS

I haven't found any posts and replies that has been of value on this site or the web.

Being a novice this challenge is beyond my skill! :)

Thanks in advance

Mel
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
VBA Code:
Option Explicit

Sub gittoCell()
    Application.Goto Reference:=Worksheets("Weighting Table WS").Range("B8")
End Sub
 
Upvote 0
I have a formula using address and match to form an address - e.g. 'Weighting Table'!$B$8 on the Check Text worksheet
.. but you have not told us what cell on 'Check Text' the formula is in. For a demo of how I understand your question, I have assumed the formula is in cell C4

VBA Code:
Sub Test()
  Application.Goto Reference:=Range(Sheets("Check Text").Range("C4").Value), Scroll:=True
End Sub
 
Upvote 0
my apologies for missing out important steps.
1. On Text Match WS there is a range that holds the criteria for assessment across 3 columns and 8 rows, columns are Category, Search Criteria Category, Search Criteria Text
2. There is a checking process (using Exact formula) on worksheet Text Match comparing the text in all of the 3 columns in the row - say Row 8, against a sheet called Weighting Table
3. Where a mismatch is found the address of the mismatch is given for example - 'Weighting Table'!$B$8 (or it could be $A$8, or $C$8)
4. The check process is carried out against the 8 rows - a mismatch could occur in any of the 24 cells

What I was wondering is if there is VBA that could read the address, (which in this case would be in $D$8, being 'Weighting Table'!$B$8) and take the user to that address perhaps via an icon button on Text Match at address $E$8?

I have seen MsgBox options which could work by asking the question "do you wish to go to 'Weighting Table'!$B$8 and edit criteria text?" however this may be overengineering :)

Thanks for your time.

Mel
 
Upvote 0
Suppose in cell D8 is the address in text string, i.e,
'Weighting Table'!$B$8

try below code:

PHP:
Dim wsName As String, cellAdd As String
wsName = Range("D8").Value ' return "'Weighting Table'!$B$8 "
cellAdd = Mid(wsName, InStr(3, wsName, "!") + 1, 255) ' returns "$B$8" 
wsName = Left(wsName, InStr(3, wsName, "'") - 1)' returns "'Weighting Table'"
wsName = Replace(wsName, "'", "") ' return "Weighting Table"
Sheets(wsName).Activate
Range(cellAdd).Select
 
Upvote 0

Forum statistics

Threads
1,223,879
Messages
6,175,145
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top