PDA

View Full Version : VBA error 1004



Svmaxcel
10-20-2017, 09:49 AM
I get error 1004 while running VBA, range error
Sometimes it how's through properly and sometimes get stuck.
I'm using a basic code like worksheets("test"). Range("a1"). Select
Tried to step in the code and got error on first line.
Code is saved in same worksheets.
Is there any reason that I get this error sometimes.

Paul_Hossler
10-20-2017, 10:02 AM
1. Yes, there is a reason that you can get that error sometimes

2. If worksheet 'test' is not the active worksheet, you'll get 1004

3. Either fix your code to not required Selecting (preferred), or select the worksheet first:



Worksheets("test"). Select
Range("a1"). Select

Svmaxcel
10-20-2017, 10:58 AM
Should the issue get fixed by using


[Sheet1].Activate
[Sheet1].select
Range ("a1"). Select