error 2023

meave

New Member
Joined
Aug 2, 2006
Messages
4
when i'm running the following macro i get error 2023 what does that mean and more importantly how do i fix it.

macro:
Code:
Sub OneColumnRemoveBlanks()
Dim MyColumn As Long, c As Range, i As Integer


MyColumn = Selection.Column
i = 0
For Each c In Selection
    If Len(c) > 0 Then
        Cells(c.Row - i, c.Column + 1) = c.Value
    Else
        i = i + 1
    End If
Next c


End Sub

the line
If Len(c) > 0 Then
gives the error according to visual basics.

if someone could help me with this and explain it in simple language (i can just only read macro and understand them, even this one i haven't made myself) i would be very gratefull.[/quote]
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
if have been trying various things today and i noticed that the same macro still works in an older version of my spreadsheet could anyone help me on how this could be solved i'll put.

the following macro is excecuting the previous macro.
the first is done correctly but somewhere between the first and the fourth it goes wrong.

Code:
Sub CreateItemValidation()
'
' CreateItemValidation Macro
' Macro recorded 5-8-2005 by Danny Batenburg
'

'
    Sheets("Equiped Items").Select
    Union(Range( _
        "FL:FL,FN:FN,FP:FP,FR:FR,FT:FT,FV:FV,FX:FX,FZ:FZ,GB:GB,GD:GD,GF:GF,GH:GH,GJ:GJ,GL:GL,GN:GN,GP:GP,DN:DN,DB:DB,DD:DD,DF:DF,DH:DH,DJ:DJ,DL:DL,DN:DN,DP:DP,DR:DR,DT:DT,DV:DV,DX:DX,DZ:DZ,EB:EB,ED:ED" _
        ), Range( _
        "EF:EF,EH:EH,EJ:EJ,EL:EL,EN:EN,EP:EP,ER:ER,ET:ET,EV:EV,EX:EX,EZ:EZ,FB:FB,FD:FD,FF:FF,FH:FH,FJ:FJ" _
        )).Select
    Selection.ClearContents
    Range("'Equiped Items'!DA2:DA2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!DC2:DC2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!DE2:DE2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!DG2:DG2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!DI2:DI2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!DK2:DK2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!DM2:DM2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!DO2:DO2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!DQ2:DQ2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!DS2:DS2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!DU2:DU2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!DW2:DW2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!DY2:DY2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!EA2:EA2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!EC2:EC2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!EE2:EE2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!EG2:EG2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!EI2:EI2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!EK2:EK2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!EM2:EM2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!EO2:EO2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!EQ2:EQ2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!ES2:ES2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!EU2:EU2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!EW2:EW2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!EY2:EY2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!FA2:FA2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!FC2:FC2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!FE2:FE2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!FG2:FG2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!FI2:FI2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!FK2:FK2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!FM2:FM2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!FO2:FO2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!FQ2:FQ2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!FS2:FS2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!FU2:FU2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!FW2:FW2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!FY2:FY2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!GA2:GA2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!GC2:GC2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!GE2:GE2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!GG2:GG2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!GI2:GI2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!GK2:GK2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!GM2:GM2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!GO2:GO2000").Select
    Application.Run _
        "'Kopie van Kopie van Kansloos Sheet.xls'!OneColumnRemoveBlanks"
    Range("'Equiped Items'!D2:D2").Select
    Range("'Equiped Items'!B2:B2").Select
    

End Sub

hopefully this helps to get a solution
 
Upvote 0
problem solved

the problem is solved there was a reference error in the selected area's
 
Upvote 0

Forum statistics

Threads
1,213,506
Messages
6,114,025
Members
448,543
Latest member
MartinLarkin

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