hello everyone
i want to delete every 2 cells in a row containing the value "MAIN" in
column "A" , the two cells are located in the columns B and C always.

whenever we find "Main" at a row in column "A" the program should
delete value in column "B" and "C" and shift to the left the value in
column "D'

the table is like this one

    A       B      C        D
1 Main  value  value  value
2 '
3 '
  '
n' Main value value value

i tried this but it doesn't seems to work


 '   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's where the code displays an error
    Range("B*:C*").Delete Shift:=xlToLeft
 ' End If
  'Next





End Sub

--~--~---------~--~----~------------~-------~--~----~
Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/excel-macros?hl=en

Visit & Join Our Orkut Community at 
http://www.orkut.com/Community.aspx?cmm=22913620

To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com

To see the Daily Excel Tips, Go to:
http://exceldailytip.blogspot.com
 
If you find any spam message in the group, please send an email to Ayush @ 
jainayus...@gmail.com
-~----------~----~----~----~------~----~------~--~---

Reply via email to