• 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.

Store cell addresses in different sheets to an array

YasserKhalil

Well-Known Member
Hello everyone
I have three sheets Sheet1 / Sheet2 / Sheet3
I need to create a variable (array) for the cell addresses of B4 in the three sheets ..
Thanks advanced for any help
 
You do not really need an array of addresses so much as an array of sheet names then:

Code:
For each vSheet in Array("Sheet1", "Sheet2", "Sheet3")
Sheets(vsheet).Range("B4").Value2 = "your value"
Next
 
Thanks a lot for help Mr. Debaser for this great and useful help
That's works like charm
But I still need to learn new technique by storing the addresses not the sheets ..
Best Regards
 
For that I'd store ranges not addresses - for example:
Code:
    Dim argCells(1 To 3)      As Excel.Range
    Dim n                     As Long

    For n = 1 To 3
        Set argCells(n) = Sheets("Sheet" & n).Range("B4")
    Next n
 
Thank you very much for both of you Mr. Debaser and Mr. Jindon
You are great people .. every day I learned a lot and a lot from you
Thanks a lot for this great support
Best and kind regards
 
Back
Top