LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default ? VBA to insert formula if a column is blank or not ?

Hi all,

Can anybody please help.

I have the following scenario and i can't figure the vba out...!!!

I have the following columns in 'Sheet1' in cols A, B, C

COL A- Planned Date
COL B- Re-Planned Date
COL C- Actual Date

What i am trying to do is get VBA to see if there is a 'planned date'
AND a 'Replanned Date', if there is, only use the 'replanned date' and
use the following formula

i,e,,....

If The re-planned date is blank, automatically enter the following
formula into the row (Col D)

=IF($C:$C="",0,IF($A:$A=$C:$C,1,-1))

If the re-planned date is NOT blank, automatically enter the formula
into the row (Col D)

=IF($C:$C="",0,IF($B:$B=$C:$C,1,-1))

I can get the first formula to autofil, using: -

Sub FillFormula_startdate()

Range("D1").Select

ActiveCell.FormulaR1C1 = "=IF(C3=""NA"",0,IF(C1=C3,1,-1))"

Dim Rng As Range
Set Rng = Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp))
Rng.Offset(0, ActiveCell.Column - 1).Formula = Cells(1,
ActiveCell.Column).Formula


End Sub


Any help greatly appreciated.....




Many thanks in advance

Cheers

P :-)

 
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
insert a blank column between each column in a data file Holly Excel Discussion (Misc queries) 1 October 31st 07 07:04 PM
Insert Blank Row Based on Value in Column A Kevin D Excel Programming 1 November 24th 06 01:17 AM
insert a blank row after data changes in a column cyndi Excel Discussion (Misc queries) 2 October 24th 05 02:46 PM
Insert a blank Column Every 9 Columns Nigel Bennett Excel Programming 4 March 15th 05 04:53 PM
Insert Blank Column every 9 Columns Nigel Bennett Excel Programming 2 March 15th 05 04:24 AM


All times are GMT +1. The time now is 08:14 AM.

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

About Us

"It's about Microsoft Excel"