Hi!
I have developed a Macro in VB and it works correctly when I just have one open Workbook. However, if I have multiple open workbooks, it seems that I got an error in the second code line below:
Set Values_Cell = ActiveWorkbook.Application.InputBox(prompt:="Please select the cell", Type:=8)
Values_Cell.Select
The Error Message that I got is:
Run-time error '1004
Select method of Range class failed.
To be precise, the first code line is used to get the cell address. The following line selects the cell included in Values_Cell.
E.g. if I select the cell E5, Values_Cell contains E5 if I have just one open workbook. When I have two open workbooks, InputBox returns the value in cell E5 of the other workbook. Let's say, if I have the word "number" in cell E5 of the second workbook, Values_Cell will contain "number" instead of E5.
I have tried to run the macro in many ways, but it only works correctly when I just have one open workbook. I have even tried with Set Values_Cell = Application.InputBox(prompt:="Please select the cell", Type:=8) but I have the same result.
Could you help me with some ideas, please? Any suggestion or comment will be really appreciated.
Thank you! Have a good day!
I have developed a Macro in VB and it works correctly when I just have one open Workbook. However, if I have multiple open workbooks, it seems that I got an error in the second code line below:
Set Values_Cell = ActiveWorkbook.Application.InputBox(prompt:="Please select the cell", Type:=8)
Values_Cell.Select
The Error Message that I got is:
Run-time error '1004
Select method of Range class failed.
To be precise, the first code line is used to get the cell address. The following line selects the cell included in Values_Cell.
E.g. if I select the cell E5, Values_Cell contains E5 if I have just one open workbook. When I have two open workbooks, InputBox returns the value in cell E5 of the other workbook. Let's say, if I have the word "number" in cell E5 of the second workbook, Values_Cell will contain "number" instead of E5.
I have tried to run the macro in many ways, but it only works correctly when I just have one open workbook. I have even tried with Set Values_Cell = Application.InputBox(prompt:="Please select the cell", Type:=8) but I have the same result.
Could you help me with some ideas, please? Any suggestion or comment will be really appreciated.
Thank you! Have a good day!