j8547
asked on
declare worksheet as constant
I have 3 worksheet in my workbook. I have declared them ws1 = .... ws2 = ..... ws3=.......
I have to constantly set them as i use them in most modules. How can i set them once at the begining and then reference them after.
I have to constantly set them as i use them in most modules. How can i set them once at the begining and then reference them after.
ASKER
I have Public ws1, ws2, ws3 at the top. Then in my code i have set ws 1 = thisworkbook.worksheet.... ..
the problem is i have to do this in every Sub. If i say use ws 1 without setting it again i get an error. I was looking to only set it once and thats it. Can this be done
the problem is i have to do this in every Sub. If i say use ws 1 without setting it again i get an error. I was looking to only set it once and thats it. Can this be done
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Public ws1, ws2, ws3
at the beginning of your code, so something like
Public ws1, ws2, ws3
Sub yourcode()
{yoour code
ws1 = "sheet1"
}
End Sub