• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Reference Worksheets Using Variables In A Table

Deakzyy

New Member
0
I am very green at this so be gentle with me.
What I would like to do is use table data in a master document to move between documents in VBA. I have other grand plans but this is the first step. And I am stuck already :(
The cell U3 in my master doc references text "D_1" and I want this to change the window / workbook to "Week 1.cvs".
If I change the main line to Windows(D_2).Active this functions perfect.
I will of course populate this significantly more once I get this to function.
Any advice greatly appreciated.
Cheers
>>> use code - tags <<<
Code:
Sub Window_Display_Test()
'
' Window_Display_Test Macro


Dim D_1 As String: D_1 = ("Week 1.CSV")

For i = 3 To 11

Dim Cur_Window As Range: Set Cur_Window = Range("u" & i)

MsgBox (Cur_Window)

Windows(Cur_Window).Activate

Next i

End Sub
Expected this to change between open windows / workbooks.
Instead came up with a RUNTIME error
 
Last edited by a moderator:
You wrote:
I want this to change the window / workbook to "Week 1.cvs"
and later You've: D_1 = ("Week 1.CSV")
Which You have used ... where?
Why would You like to use something like that at all?

Could You send a sample Excel-file to show
... what do You really have?
... what should happen?
Are all Cur_Window possible to activate?
 

Deakzyy

As You've had to read from many sites:
  • Cross-Posting. Generally, it is considered poor practice to cross post. That is to post the same question on several forums in the hope of getting a response quicker.
  • If you do cross-post, please put that in your post.
  • Also if you have cross-posted and get an Solution elsewhere, have the courtesy of posting the Solution here so other readers can learn from the answer also, as well as stopping people wasting their time on your answered question.
 
Back
Top