PDA

View Full Version : Sleeper: Inserting into a named range



sulrich
03-03-2005, 05:11 PM
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:banghead: .

Paleo
03-03-2005, 09:12 PM
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.