Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
IF/THEN Statement - Simple Question....
MSTeam,
I have a situation where a portion of a macro I have written adds a column when ran. How can I create code that will check to see if this column is already there so, if that portion of the macro see's this column, it does not add a column. Here's what I have thus far (inserts colume and labels it "Flagged"): Columns("B:B").Select Selection.Insert Shift:=xlToRight Range("B6").Select ActiveCell.FormulaR1C1 = "Flagged" With ActiveCell.Characters(Start:=1, Length:=7).Font .Name = "Tahoma" .FontStyle = "Bold" .Size = 8 End With Simple enough. I need something like an IF statement that checks if "Flagged" exists and skips this portion of the code. Thanks for all your time and energy, -m |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
IF/THEN Statement - Simple Question....
If Range("B6") < "Flagged" Then
Columns("B").Insert Range("B6").Value = "Flagged" With ActiveCell.Characters(Start:=1, Length:=7).Font .Name = "Tahoma" .FontStyle = "Bold" .Size = 8 End With End If -- Charles Chickering "A good example is twice the value of good advice." "mvyvoda" wrote: MSTeam, I have a situation where a portion of a macro I have written adds a column when ran. How can I create code that will check to see if this column is already there so, if that portion of the macro see's this column, it does not add a column. Here's what I have thus far (inserts colume and labels it "Flagged"): Columns("B:B").Select Selection.Insert Shift:=xlToRight Range("B6").Select ActiveCell.FormulaR1C1 = "Flagged" With ActiveCell.Characters(Start:=1, Length:=7).Font .Name = "Tahoma" .FontStyle = "Bold" .Size = 8 End With Simple enough. I need something like an IF statement that checks if "Flagged" exists and skips this portion of the code. Thanks for all your time and energy, -m |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
IF/THEN Statement - Simple Question....
Charles!!!!!
Thanks, Mark "Charles Chickering" wrote: If Range("B6") < "Flagged" Then Columns("B").Insert Range("B6").Value = "Flagged" With ActiveCell.Characters(Start:=1, Length:=7).Font .Name = "Tahoma" .FontStyle = "Bold" .Size = 8 End With End If -- Charles Chickering "A good example is twice the value of good advice." "mvyvoda" wrote: MSTeam, I have a situation where a portion of a macro I have written adds a column when ran. How can I create code that will check to see if this column is already there so, if that portion of the macro see's this column, it does not add a column. Here's what I have thus far (inserts colume and labels it "Flagged"): Columns("B:B").Select Selection.Insert Shift:=xlToRight Range("B6").Select ActiveCell.FormulaR1C1 = "Flagged" With ActiveCell.Characters(Start:=1, Length:=7).Font .Name = "Tahoma" .FontStyle = "Bold" .Size = 8 End With Simple enough. I need something like an IF statement that checks if "Flagged" exists and skips this portion of the code. Thanks for all your time and energy, -m |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF formula-simple question; simple operator | Excel Discussion (Misc queries) | |||
IF/THEN Statement - Simple Question... | Excel Programming | |||
Simple Simple Excel usage question | Excel Discussion (Misc queries) | |||
Another Quick Simple VBA question (if...then statement) | Excel Programming | |||
simple question, hopefully a simple answer! | Excel Programming |