LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mbarnes
 
Posts: n/a
Default Adding a Function to a cell when inserting a row from a macro

I am trying to add a function to a cell that would be in a new line that I am
adding from a macro. See My macro (below). The marco is connected to a button
in the worksheet. When I click the button it adds a new line at the top under
the column headings. I have some titles and other wording in the top rows. In
each colum I have filled the cells and made lists, which are hidden, rows 5
through 16. I use those to create a drop down list when you enter in data on
the new row.

The worksheet is for budget tracking. In Column F is "Budgeted Cost", in the
next Column G is "Actual $ spent". In Column H, I am using the function:
=IF(F17<"",IF(G17F17,"Over","Under"),"").

It only looks at the row(17). I want it to go on each row and I don't want
to copy it to every row I want the macro to add it to the new row. I would
like it to reference the row that is being modified not row 17, so If there
is a change later to say G:50 it will change H:50

My function

=IF(G17<"",IF(G17F17,"Over","Under"),"")

currently does this:
1. it looks to see if anything is in column G: G17<""
2. If column F has anything in it, it will check to see if column G (Actual
$ spent) is greater than Column F (Budgeted Cost)
3. If Column G F it will display "Over" in Column H
4. If Column G < F it will display "Under" in Column H

My Macro:

Sub Addnewline()
' Addnewline Macro
'
' Adds a new line at the top of worksheet under the column titles
Rows("17:17").Select
Selection.Insert Shift:=xlDown
End Sub

 
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
cell ref in function formula change when inserting additional colu STAR263 Excel Worksheet Functions 1 May 18th 06 11:04 PM
Custom functions calculating time arguments Help Desperate Bill_De Excel Worksheet Functions 12 April 25th 06 02:22 AM
Row Expansion Susan Excel Worksheet Functions 11 February 28th 06 07:15 PM
Adding a row to worksheet does not update cell references in another. blausen Excel Worksheet Functions 5 February 25th 06 09:14 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM


All times are GMT +1. The time now is 09:45 PM.

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"