+ Reply to Thread
Results 1 to 6 of 6

Adding rows and embedded formulas depending on user input

Hybrid View

haitham1984 Adding rows and embedded... 11-06-2008, 02:17 AM
DonkeyOte Hi, I think you'd need to... 11-06-2008, 07:25 AM
haitham1984 Yea sorry, my fault. I'll be... 11-06-2008, 08:01 AM
DonkeyOte Same rules apply pretty... 11-06-2008, 08:39 AM
haitham1984 OOOh I see, Sorry Donkey,... 11-06-2008, 09:02 AM
DonkeyOte haitham1984 --- we're getting... 11-06-2008, 11:04 AM
  1. #1
    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

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address(0, 0) <> "A5" Then Exit Sub
    If Len(Target.Value) > 0 Then
       Rows("78:80").Insert
       With Range("A78:C80")
           .Formula = "=IF(ROW()>79,1,0)"
           .Font.Bold = True
       End With
    End If
    End Sub

  2. #2
    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.

  3. #3
    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