E
emma
Hi!
I have a problem with my VBA code when I try to read values from cells
in two different worksheets. When I run the macro the program tells me
that I´m out of bound. But everything works when I save the data in
the same worksheet. How shold I write the code so that this simple
thing could work?
The data should be read when the user makes a buttonlick and then it
will be used later on.
The code is simple like this:
Public Sub Button1_Click()
A = Worksheets("Page1").Range("N8").Value
B = Worksheets("Page2").Range("I8").Value
I want to save the values from cell N8 in the variable A and so on...
It seems like only one worksheet can be active when I write the code
like this. I have tried commands like Sheets("Page2").Select
but still it is not working
I hope you can help me!
I have a problem with my VBA code when I try to read values from cells
in two different worksheets. When I run the macro the program tells me
that I´m out of bound. But everything works when I save the data in
the same worksheet. How shold I write the code so that this simple
thing could work?
The data should be read when the user makes a buttonlick and then it
will be used later on.
The code is simple like this:
Public Sub Button1_Click()
A = Worksheets("Page1").Range("N8").Value
B = Worksheets("Page2").Range("I8").Value
I want to save the values from cell N8 in the variable A and so on...
It seems like only one worksheet can be active when I write the code
like this. I have tried commands like Sheets("Page2").Select
but still it is not working
I hope you can help me!