Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Clearing contents beyond the "Z" column
Hello,
Below is the code I am using for a button on my sheet. All works well, but it is not clearing the contents of the new row beyond column "Z". If I make the k value larger (instead of 1 to 25, I put 1 to 37 as I want it till column AN) then I get an error and beyond column "Z" no contents are cleared in the new row. Any help will be much appreciated! Thank you! ******************** Private Sub CommandButton1_Click() For i = 1 To 10000 If ActiveSheet.Range("C" & i).Value = "BLENDING FACILITIES" Then Range("C" & (i + 1) & ":" & "AN" & (i + 1)).Select Selection.Copy Selection.Insert Shift:=xlDown For k = 1 To 25 If ActiveSheet.Range(Chr(65 + k) & (i + 1)).HasFormula = False Then ActiveSheet.Range(Chr(65 + k) & (i + 1)).ClearContents End If Next Exit For End If Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Convert cell "contents" into a "comment" | Excel Discussion (Misc queries) | |||
how to increase size of "name box" and "contents of cell " displa. | New Users to Excel | |||
Please add a "sheet" function like "row" and "column" functions | Excel Programming | |||
How do I split "A1B2" into "A1" and "B2" using text to column fun. | Excel Programming | |||
Clearing Contents of all "unprotected" Cells. | Excel Programming |