run time error 1004

mrinal saha

Board Regular
Joined
Jan 20, 2009
Messages
229
hi folks,

I am getting a stupid error, because of which entire project will go in vain.

just trying to convert some data from text to column. earlier i did it but now when i try to run with bunch of macro, it doesn't work. as soon as i select column(a:a)in code, i get error.

error received is :-
run time error 1004
application defined or object defined error

this is the piece of code..

Sheets("ACTD30BVR01").Activate
'text to column ACTD30BVR01
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("B1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 2), Array(16, 1), Array(21, 2), Array(31, 1), Array(37, 1), _
Array(48, 1), Array(82, 2), Array(101, 1), Array(106, 1), Array(128, 1), Array(133, 1), _
Array(143, 1)), TrailingMinusNumbers:=True
Columns("A:A").Delete


thanks,
Mrinal
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Does it work if you don't select?

Code:
Sheets("ACTD30BVR01").Activate
'text to column ACTD30BVR01
With Columns("A")
    .TextToColumns Destination:=Range("B1"), DataType:=xlFixedWidth, _
    FieldInfo:=Array(Array(0, 2), Array(16, 1), Array(21, 2), Array(31, 1), Array(37, 1), _
    Array(48, 1), Array(82, 2), Array(101, 1), Array(106, 1), Array(128, 1), Array(133, 1), _
    Array(143, 1)), TrailingMinusNumbers:=True
    .Delete
End With
 
Upvote 0
Is the column protected or hidden?
Does the worksheet name you are referencing exist?
 
Upvote 0
Try it without activating the sheet..

Code:
With Sheets("ACTD30BVR01")
    .Columns("A:A").TextToColumns Destination:=.Range("B1"), DataType:=xlFixedWidth, _
    FieldInfo:=Array(Array(0, 2), Array(16, 1), Array(21, 2), Array(31, 1), Array(37, 1), _
    Array(48, 1), Array(82, 2), Array(101, 1), Array(106, 1), Array(128, 1), Array(133, 1), _
    Array(143, 1)), TrailingMinusNumbers:=True
    
    .Columns("A:A").Delete
End Sub

Also,
Is the sheet protected?
Are there any merged cells in the range?
 
Upvote 0
Hi All,

Thanks for your reverts..but doesn't help.

code doesn't work without activatiing the sheet .

column is not hidden or protected.
sheets name ref is ok.

:(
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top