+ Reply to Thread
Results 1 to 6 of 6

Adding rows and embedded formulas depending on user input

  1. #1
    Registered User
    Join Date
    10-31-2008
    Location
    asia
    Posts
    32

    Adding rows and embedded formulas depending on user input

    Hi all,

    Is it possible to insert 3 rows (between rows 81 and 82) when a user inserts a value greater than 0 in cell A5? And also, how can I insert formula's into these 3 rows?

    Thank you for your time.
    Last edited by haitham1984; 11-06-2008 at 03:38 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    Hi, I think you'd need to elaborate a little in terms of the formulae you want to insert but below is a proof of concept and shows how you can manage the newly inserted ranges - ie add formulas, change font etc...

    Please Login or Register  to view this content.
    To insert this - right click on the Tab name in which you want this to fire - select View Code - paste in the above to the resulting window.

    You should find that when A5 is changed to > 0 3 rows are added.

    However -- this will occur every time you change the value in A5 -- is this what you want ? ie continuously add 3 rows ?

    Post back with more detailed info if the above does not resolve your issue.

  3. #3
    Registered User
    Join Date
    10-31-2008
    Location
    asia
    Posts
    32
    Yea sorry, my fault. I'll be more specific.

    I want a code that when a user writes something (TEXT not number) 3 rows are added to a table which I have already created. The dimension of my existing table is...B67:G80 (Rows=2 <67,68>,3 <69,70,71>,3 <72,73,74>,3 <75,76,77>,3 <78,79,80>)...when the user writes something in cell A5, I want to add 3 rows between rows 77 and 78, to my existing table.

    Thank you for your time, and forgive my lackof information the first time round.
    Last edited by haitham1984; 11-06-2008 at 08:06 AM.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    Same rules apply pretty much... but you've still not said what you want to go into your newly inserted rows in terms of formulae etc... so what's inserted below is merely an example to show how you can add them... in this case you should find A80:C80 contain 1 and A78:C79 contain 0

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-31-2008
    Location
    asia
    Posts
    32
    OOOh I see, Sorry Donkey, this is the first time I use Visual Basic.

    Well it's somewhat complicated, but here goes.

    3 column's from the newly added 3 throws will simply refer (call) a cell early in the worksheet. For example one column will simply say:

    =C80=A5

    The other columns from the newly inserted rows will have formulas which it took me ages to understand...but here is an example of one of them:

    =IF(ISNA(VLOOKUP("yes_1",$C$32:$E$48,3,FALSE)), "", VLOOKUP("yes_1",$C$32:$E$48,3,FALSE))

    I want this formula to be in a column from the 3 inserted rows, I wish there is a way to simply drag the equation down from the previous row of the table so it simply copies the equation.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    haitham1984 --- we're getting there... to avoid confusion let's assume the following... user has entered text into A5 and now we have three brand new rows of data, namely rows 78, 79 & 80.

    Now what exactly goes in each cell... please be as specific as possible...

    ie you say one column will say C80=A5 -- where does this formula go ? (obviously not in C80!)

    On a slightly different note -- if we were to look at the contents of row 77 ie the last row of data prior to our newly inserted rows would the formulae going into rows 78:80 be exact copies of the formulae in row 77 (give or take the odd relative cell reference) ?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1