Consulting

Results 1 to 2 of 2

Thread: Sleeper: Inserting into a named range

  1. #1
    VBAX Newbie
    Joined
    Mar 2005
    Posts
    1
    Location

    Sleeper: Inserting into a named range

    I need help with writing a code for inserting into a named range. For example, when I insert into a specified range the range increase, but keeps it format. See below...hopefully the diagram makes is clear.

    Color Type Qty BlueWidget10 BlueWidget5 BlueWidget3 BlueWidget1 BlueWidget4 BlueWidget7 BlueWidget15 BlueWidget20 BlueWidget28 YellowWidget3YellowWidget6 YellowWidget8 YellowWidget 11 YellowWidget7 YellowWidget23

    The yellow colored range is "Data" and the orange colored range is "Data1". I want to insert what I have on my userform at the end of "Data1". I appreciate any help .

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Master
    Joined
    Jan 2005
    Location
    Porto Alegre - RS - Brasil
    Posts
    1,219
    Location
    Hi if you simply need to add it after that data it would be done like this (assuming the ranges are A; B & C):


    Sub button1_Click()
       Dim ULin As Long
       ULin = Range("A65536").End(xlUp).Row
       Range("A" & ULin + 1) = txtColor
       Range("B" & ULin + 1) = txtType
       Range("C" & ULin + 1) = txtQty
    End Sub

    That assuming you dont need to add this new data to the named area, just need to put it bellow that.
    Best Regards,

    Carlos Paleo.

    To every problem there is a solution, even if I dont know it, so this posting is provided "AS IS" with no warranties.

    If Debugging is harder than writing a program and your code is as good as you can possibly make
    it, then by definition you're not smart enough to debug it.




    http://www.mugrs.org

Posting Permissions

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