View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Hans Weustink[_5_] Hans Weustink[_5_] is offline
external usenet poster
 
Posts: 6
Default Select sheet based on reference

That's indeed the intention of the AString variable, but the value of the
cell is identical to a different sheet then the current one and yet the code
doesn't work.

So my question merely was what alternative is there are change do I have to
make to the code because it doesn't work,

Thanks,
Hans

"gocush" wrote:

The reason
Sheets(AString).Select
does not work is because you have assigned to the variable AString
the value that is in Range A1 of your Input Sheet

If range A1 of your Input sheet contains the name of another Sheet,
then your code will select that sheet.

"Hans Weustink" wrote:

Hi,

I'm able to selecet a workbook, but not a sheet based on a reference like so:

Sub test()
Dim AString
AString = Sheets("Input").Range("A1").Value

Windows(AString).Activate = works
Sheets(AString).Select = doesn't work
End Sub

Can someone think of a (alternative) way it will work?

Thanks in advance,
Hans Weustink