ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   IF/THEN Statement - Simple Question... (https://www.excelbanter.com/excel-programming/374708-if-then-statement-simple-question.html)

mvyvoda

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

smw226 via OfficeKB.com

IF/THEN Statement - Simple Question...
 
Hi,

This should be what you need assuming that B6 contains your flagged value

Thanks,

Simon

range("B6").select
if activecell.value <"Flagged" then

do your stuff

end if

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200610/1



All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com