But to answer your original question about using a Macro. Yes, you can do so, but you do have a couple of options here...
As mentioned, you can use the Global Connections>Display> RemoteDisplayNumber to ascertain when the Display number you want to navigate to, with your button, is currently active. RemoteDisplayNumber is usually for reading the current Display number in a PLC but can be read just locally.
Using this current Display number, you can locally change a tag value using a Macro, or remotely in the PLC using logic.
Locally using Macro...
Create a HMI tag of Analog type and call it Current_Display_Number, for instance.
Make its Data Source Memory.
Go to Global Connections>Display>RemoteDisplayNumber and assign it the tag...
{Current_Display_Number}
...exactly as I have just typed it, brackets and all.
The current Display number will now always be written to this tag.
Next, create a HMI tag that you want to change when you press the button or select an existing one.
For my example I'm using HMI_Digital_Tag_To_Change.
Next, under Global Connections>Macro for Remote Macro1 select the Exprn... button to open the Expression editor.
Type...
If {Current_Display_Number} == 5
Then {HMI_Digital_Tag_To_Change} == 1
Else {HMI_Digital_Tag_To_Change} == 0
...using the syntax above, but replace my examples with your actual tags and values.
Press the Check Syntax button as you go to make sure the Expression is Valid.
This Macro will execute at the set update rate and as soon as the current Display number equals your GoTo button's Display number, the tag will be written to with the new value, else it is always set to the other value.
If you were just looking to change a HMI tag value then I would recommend using this method. It can, however, also be used to update a PLC tag.
Remotely using PLC logic...
This is what the others are referring to, I think, and what is probably most often used. I just outlined the Macro option to show it can be done.
For the same Global Connections>Display>RemoteDisplayNumber assign it a PLC tag which will always be written to with the current Display number. In the PLC, use an EQU (Equals) instruction with the PLC tag and a constant value, matching the relevant Display number. From a true evaluation of this instruction you can then execute whatever logic you require to update the tag(s) you want.
Regards,
George