hello everyone
i have a table like this one :
A B C D
1 "Main" | value | value | value
2 "Extra" | value | value | value
'
'
n "Main" | value | value | value
i created a macro that deletes the two cells located in column "B" and "C" and shift the value in column "D" to the left whenever in finds "Main" in range("A")
here's the code he doesn't work properly i don't know why:
Dim MyColumn As String
Dim MyRange As Range, MyRange1 As Range
MyColumn = "A"
myvalue = "MAIN"
lastrow = Cells(Rows.Count, MyColumn).End(xlUp).Row
Set MyRange = Range(MyColumn & "1:" & MyColumn & lastrow)
For Each c In MyRange
If (c.Value) = myvalue Then
'here the code displays an error
Range("B*:C*").Delete Shift:=xlToLeft
End If
Next
plz help
Bookmarks