+ Reply to Thread
Results 1 to 2 of 2

Adding mutiple rows

Hybrid View

  1. #1
    Registered User
    Join Date
    08-26-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    6

    Adding mutiple rows

    Hi, I would like to have a button where the user can add a new product.
    So when clicking the button, four new rows should be added with the right style.

    See attached pictures

    2013-08-26_085638.png

    2013-08-26_085742.png

  2. #2
    Registered User
    Join Date
    08-26-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Adding mutiple rows

    I did this...

    Private Sub add_product_Click()
        ActiveSheet.Unprotect
        ActiveSheet.Range("A4").Select
        ActiveCell.EntireRow.Insert Shift:=xlDown
        ActiveCell.EntireRow.Insert Shift:=xlDown
        ActiveCell.EntireRow.Insert Shift:=xlDown
        ActiveCell.EntireRow.Insert Shift:=xlDown
        
        Range("B5:G5").Select
        Selection.Merge
          
        Range("A4:SM4").Select
        Selection.Locked = True
        With Selection.Interior
            .PatternColorIndex = xlAutomatic
            .Color = RGB(244, 176, 132)
            .TintAndShade = 0
            .PatternTintAndShade = 0
        End With
       
        Range("A11").Select
        Application.CutCopyMode = False
        Selection.Copy
        
        Range("A7").Select
        ActiveSheet.Paste
        Range("A7").Select
        Selection.Locked = False
        Selection.HorizontalAlignment = xlCenter
        
        Range("B5:G5").Select
        ActiveCell.FormulaR1C1 = "Insert product name"
        Range("A10").Select
        Selection.Copy
        Range("A6").Select
        ActiveSheet.Paste
      
        Application.CutCopyMode = False
        Range("H9:SM11").Select
        Selection.Copy
        Range("H5:SM7").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        Selection.ClearContents
        
        Range("B6:G7").Select
        Selection.NumberFormat = "0.00"
        With Range("B6:G7").Validation
            .Add Type:=xlValidateDecimal, _
            AlertStyle:=xlValidAlertStop, _
            Operator:=xlBetween, Formula1:="0", Formula2:="99999"
            .InputTitle = "Integers"
            .ErrorTitle = "Integers"
            .InputMessage = "Enter an decimal or integer"
            .ErrorMessage = "You must enter a decimal or integer"
        End With
                
        ActiveSheet.Range("A5").Select
        With ActiveSheet.Buttons.Add(Selection.Left, Selection.Top, Selection.Width, Selection.Height)
            .OnAction = "delete_click"
            .Characters.Text = "Delete Product"
        End With
        
        Range("B5").Select
        Selection.Locked = False
        
        Range("B6:G7").Select
        Selection.Locked = False
        
        Range("H5:SM5").Select
        Selection.Locked = False
         
        ' This must be open when $ is chosen
        Range("H6:SM6").Select
        Selection.Locked = False
        
        Range("H7:SM7").Select
        Selection.Locked = True
        
        
        Application.ScreenUpdating = True
        ActiveWorkbook.Save
        ActiveSheet.Protect
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Formula for adding mutiple numbers in one cell
    By joeybisho in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-17-2013, 10:39 PM
  2. Conditional formating, mutiple variables, mutiple sheets
    By Adam_D in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-11-2012, 06:47 AM
  3. Replies: 0
    Last Post: 01-06-2012, 07:09 AM
  4. Vlookup Help! Adding mutiple values.
    By mightybhwk in forum Excel General
    Replies: 3
    Last Post: 12-15-2011, 02:05 PM
  5. calculate mutiple rows and columns
    By Niggy in forum Excel General
    Replies: 2
    Last Post: 01-08-2010, 04:57 PM

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