Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms to populate cells in a worksheet
I can do this in Word with bookmarks. is there a way do this in Excel?
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms to populate cells in a worksheet
The short answer is yes. But you need to amplify your requirement to allow
someone to offer a specific approach to the solution. You can use TextBox, ListBox, ComboBox, Labels and even InputBoxes. "Office_Novice" wrote: I can do this in Word with bookmarks. is there a way do this in Excel? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms to populate cells in a worksheet
Sorry about that. I have a userForm with a label, a textBox, and a
CommandButton after clicking the commandButton i would like for the Text in the TextBox to populate a specific Cell i.e. A1 then hide. any help would be great code snippets would be ideal thanks. "JLGWhiz" wrote: The short answer is yes. But you need to amplify your requirement to allow someone to offer a specific approach to the solution. You can use TextBox, ListBox, ComboBox, Labels and even InputBoxes. "Office_Novice" wrote: I can do this in Word with bookmarks. is there a way do this in Excel? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms to populate cells in a worksheet
Hi
You can get the data from the userform on to the sheet by referencing the cell you want the data to go to. i.e. 'By referencing the activecell you can pass 'a value from a form to the worksheet though 'this can be a little dodgy if the wrong cell 'is selected it can lead to loss of data ActiveCell.Value = TextBox1.Value 'This gives you a reference to the range A1 'from there you can pass the value to it 'using "Range" will allow you to pass use 'strings as you cell references which is very 'handy if you have declared a range that you 'wish to pass the data to i.e. 'Dim MyRng as Range 'set MyRng as Range("A1") 'Range(MyRng).Value=TextBox1.value Range("A1").Value = TextBox1.Value 'If you know exactly which cell you are 'going to use you can do without adding '"Range" at the start and just Giving the 'range reference in square brackets [A1].Value = TextBox1.Value 'You can move in any direction using 'offset which will reference the cell that 'is by the amount of rows and columns that 'you declare, below would reference one cell 'to the right. This can also be used with 'negative numbers i.e. (-1,0) [A1].Offset(0, 1).Value = TextBox2.Value 'Keeping offset in mind you can reference the 'next blank row by finding the end of the data 'working your way up the sheet until a value is 'found then setting the reference to offset by 'one row this will give you the next empty row [A65535].End(xlUp).Offset(1, 0) = TextBox3.Value 'A more reliable way of making sure you get the 'correct cell is to reference it using "Cells()" 'this works by giving the row number and then 'the column number within the brackets Cells(1, 1).Value = TextBox1.Value 'This would be the same as offsetting 1 cell 'to the right Cells(1, 2).Value = TextBox2.Value 'You can also pass values to the reference "Cells" i.e. 'Dim a, b As Integer 'a = 10 'b = 10 'Cells(a, b).Value = TextBox1.Value I hope this is of some help to you this is not the be all and end of getting values from your form into your worksheet but it should give you an idea of how it works. Steve |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms to populate cells in a worksheet
I'd start with Debra Dalgleish's site:
http://contextures.com/xlUserForm01.html and http://contextures.com/xlUserForm02.html Office_Novice wrote: I can do this in Word with bookmarks. is there a way do this in Excel? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Automatically populate cells based on info in another worksheet | Excel Worksheet Functions | |||
Populate Order worksheet from Quote worksheet | Excel Worksheet Functions | |||
populate cell on worksheet 2 if text is red on worksheet 1 | Excel Worksheet Functions | |||
Userforms in a separate worksheet | Excel Programming | |||
userforms and worksheet help | Excel Programming |