Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop and delete
I have the following code to loop through the cells in AZ:
Dim myRange As Range Dim myCell As Range With ActiveSheet Set myRange = Range("AZ14:AZ33") End With For Each myCell In myRange.Cells If myCell.Value = lstObj.Text Then myCell.Value = "" 'Here I want to delete the values in cell J to BB!!! End If Next myCell Now it deletes the values in myCell but I want to change this to delete the values in the cells J to BB. How can this be done? I'm very grateful for fast response. Regards, S |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop and delete
Hi,
ActiveCell.Offset(0, -42).Range("A1:AS1").ClearContents HTH Carim |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop and delete
S,
Cells(myCell.Row,"J").Resize(1,19).ClearContents Or Range(Cells(myCell.Row,"J"), Cells(myCell.Row,"BB")).ClearContents HTH, Bernie MS Excel MVP wrote in message ups.com... I have the following code to loop through the cells in AZ: Dim myRange As Range Dim myCell As Range With ActiveSheet Set myRange = Range("AZ14:AZ33") End With For Each myCell In myRange.Cells If myCell.Value = lstObj.Text Then myCell.Value = "" 'Here I want to delete the values in cell J to BB!!! End If Next myCell Now it deletes the values in myCell but I want to change this to delete the values in the cells J to BB. How can this be done? I'm very grateful for fast response. Regards, S |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop and delete
Oops, I counted to AB, not BB:
Cells(myCell.Row,"J").Resize(1,45).ClearContents HTH, Bernie MS Excel MVP "Bernie Deitrick" <deitbe @ consumer dot org wrote in message ... S, Cells(myCell.Row,"J").Resize(1,19).ClearContents Or Range(Cells(myCell.Row,"J"), Cells(myCell.Row,"BB")).ClearContents HTH, Bernie MS Excel MVP wrote in message ups.com... I have the following code to loop through the cells in AZ: Dim myRange As Range Dim myCell As Range With ActiveSheet Set myRange = Range("AZ14:AZ33") End With For Each myCell In myRange.Cells If myCell.Value = lstObj.Text Then myCell.Value = "" 'Here I want to delete the values in cell J to BB!!! End If Next myCell Now it deletes the values in myCell but I want to change this to delete the values in the cells J to BB. How can this be done? I'm very grateful for fast response. Regards, S |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop and delete
Thank's a lot Bernie! Your solution is great.
Regards, S Bernie Deitrick skrev: Oops, I counted to AB, not BB: Cells(myCell.Row,"J").Resize(1,45).ClearContents HTH, Bernie MS Excel MVP "Bernie Deitrick" <deitbe @ consumer dot org wrote in message ... S, Cells(myCell.Row,"J").Resize(1,19).ClearContents Or Range(Cells(myCell.Row,"J"), Cells(myCell.Row,"BB")).ClearContents HTH, Bernie MS Excel MVP wrote in message ups.com... I have the following code to loop through the cells in AZ: Dim myRange As Range Dim myCell As Range With ActiveSheet Set myRange = Range("AZ14:AZ33") End With For Each myCell In myRange.Cells If myCell.Value = lstObj.Text Then myCell.Value = "" 'Here I want to delete the values in cell J to BB!!! End If Next myCell Now it deletes the values in myCell but I want to change this to delete the values in the cells J to BB. How can this be done? I'm very grateful for fast response. Regards, S |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Loop & Delete | Excel Discussion (Misc queries) | |||
find, delete, repeat loop | Excel Programming | |||
loop and delete | Excel Programming | |||
A loop to delete | Excel Programming | |||
loop to delete rows... | Excel Programming |