Home |
Search |
Today's Posts |
#1
|
|||
|
|||
simplify code
Hi,
I'm pretty new to writing code, so I wanted to ask for some advice. I've got a code which checks to see if cells in two columns are equal, and if they are not, it inserts blank cells in three columns. It works, but it is pretty slow, as I have written three separate IF statements for inserting blank cells. Is there any way that I can condense this into one IF statement? the code I am using so far is: LastRow = ActiveSheet.Cells(Rows.Count, "b").End(xlUp).Row Range("E1").Select For j=1 To LastRow If Range("b" & j) < Range("a" & j) Then Range("b" & j).Select Selection.Insert Shift:=xlDown If Range("b" & j) < Range("a" & j) Then Range("c" & j).Select Selection.Insert Shift:=xlDown If Range("b" & j) < Range("a" & j) Then Range("d" & j).Select Selection.Insert Shift:=xlDown Range("e" & j).Select Next j Any help would be greatly appreciated. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Change case...help please | Excel Worksheet Functions | |||
Macro for changing text to Proper Case | Excel Worksheet Functions | |||
Using other workbooks.. | Excel Worksheet Functions | |||
Make Change Case in Excel a format rather than formula | Excel Worksheet Functions | |||
Opening a file with code without a set file name | Excel Discussion (Misc queries) |