Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
IF/THEN Statement - Simple Question... mvyvoda Excel Programming 1 October 9th 06 10:07 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM
Another Quick Simple VBA question (if...then statement) abxy[_35_] Excel Programming 6 February 27th 04 09:48 AM
simple question, hopefully a simple answer! Matt B Excel Programming 5 January 13th 04 08:43 PM


All times are GMT +1. The time now is 12:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"