Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range selection
Hello everybody and many thanks for the help,
I guess it is pretty straightforward if you know it but I dont. I have a list of row and so For i = 1 to 600 and then an If expression and after then I want a range of two cells to be deleted I am trying this writing but obviously not working, any suggestions? Worksheets("ESX").Range("K" & i & ":L" & i).ClearContents What I want is Cells columns K and L for line i to be deleted but at the same time, not first K then L but altogether, that is why I am using Range("K" & i & ":L" & i). But I am not putting the " and & at the right place, can you please help? Thanks in advance! DR |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range selection
I just through an example together which works. Just change it to suit.
Sub test() Dim i As Integer For i = 1 To 40 If Range("A" & i).Value = 1 Then Range("B" & i & ":C" & i).ClearContents End If Next i End Sub Hope it helps wrote in message oups.com... Hello everybody and many thanks for the help, I guess it is pretty straightforward if you know it but I dont. I have a list of row and so For i = 1 to 600 and then an If expression and after then I want a range of two cells to be deleted I am trying this writing but obviously not working, any suggestions? Worksheets("ESX").Range("K" & i & ":L" & i).ClearContents What I want is Cells columns K and L for line i to be deleted but at the same time, not first K then L but altogether, that is why I am using Range("K" & i & ":L" & i). But I am not putting the " and & at the right place, can you please help? Thanks in advance! DR |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range selection
Thats just perfect many thanks!
Graham Whitehead a écrit : I just through an example together which works. Just change it to suit. Sub test() Dim i As Integer For i = 1 To 40 If Range("A" & i).Value = 1 Then Range("B" & i & ":C" & i).ClearContents End If Next i End Sub Hope it helps wrote in message oups.com... Hello everybody and many thanks for the help, I guess it is pretty straightforward if you know it but I dont. I have a list of row and so For i = 1 to 600 and then an If expression and after then I want a range of two cells to be deleted I am trying this writing but obviously not working, any suggestions? Worksheets("ESX").Range("K" & i & ":L" & i).ClearContents What I want is Cells columns K and L for line i to be deleted but at the same time, not first K then L but altogether, that is why I am using Range("K" & i & ":L" & i). But I am not putting the " and & at the right place, can you please help? Thanks in advance! DR |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range selection
Your code works fine for me. However, you could just as easily use:
Worksheets("ESX").Cells(i, "K").Resize(1, 2).ClearContents In article .com, wrote: Hello everybody and many thanks for the help, I guess it is pretty straightforward if you know it but I dont. I have a list of row and so For i = 1 to 600 and then an If expression and after then I want a range of two cells to be deleted I am trying this writing but obviously not working, any suggestions? Worksheets("ESX").Range("K" & i & ":L" & i).ClearContents What I want is Cells columns K and L for line i to be deleted but at the same time, not first K then L but altogether, that is why I am using Range("K" & i & ":L" & i). But I am not putting the " and & at the right place, can you please help? Thanks in advance! DR |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Narrow Range based on Selection in Another Range | Excel Discussion (Misc queries) | |||
Identifying a selection of a selection of a range | Excel Worksheet Functions | |||
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. | Excel Programming | |||
Range Selection | Excel Programming | |||
Creating range name for a range selection | Excel Programming |