Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable coding
I have programmed an excel "form" to dump data entry into a "sheet" in the
same work book. On the save button: Worksheets("Successor").Range("b2").Value = cboPositionID1 Worksheets("Successor").Range("c2").Value = cboReadiness1 Worksheets("Successor").Range("d2").Value = txtDev1 On the form initulitazion: Me.cboPositionID1.Value = Worksheets("Successor").Range("b2").Value Me.cboReadiness1.Value = Worksheets("Successor").Range("c2").Value Me.txtDev1.Value = Worksheets("Successor").Range("d2").Value These are 3 fields for ONE row on the form. However, I need to make 20 rows with the same 3 fields and they would dump in to successive rows Example Row 1 field1 Worksheets("Successor").Range("b2").Value = cboPositionID1 Row 2 field 1 Worksheets("Successor").Range("b3").Value = cboPositionID2 And so on. So - not too hard to program but also way more code then necessary. Something more elegant would be to have variables for: Cell row number & Field number (cboPositionID1 or 2 or 3....) Example: Worksheets("Successor").Range("bVarialble").Value = cboPositionIDVariable Can someone help me write that? Hope I have explained what I need Any help here will be appreciated. Thanks in advance dave |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable coding
For i = 1 To 20
Worksheets("Successor").Range("b" & i + 1).Value = Me.Controls("cboPositionID" & i).Value Worksheets("Successor").Range("c" & i + 1).Value = Me.Controls("cboReadiness" & i).Value Worksheets("Successor").Range("d" & i + 1).Value = Me.Controls("txtDev" & i).Text Next i -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Dave" <dave@accessdatapros wrote in message ... I have programmed an excel "form" to dump data entry into a "sheet" in the same work book. On the save button: Worksheets("Successor").Range("b2").Value = cboPositionID1 Worksheets("Successor").Range("c2").Value = cboReadiness1 Worksheets("Successor").Range("d2").Value = txtDev1 On the form initulitazion: Me.cboPositionID1.Value = Worksheets("Successor").Range("b2").Value Me.cboReadiness1.Value = Worksheets("Successor").Range("c2").Value Me.txtDev1.Value = Worksheets("Successor").Range("d2").Value These are 3 fields for ONE row on the form. However, I need to make 20 rows with the same 3 fields and they would dump in to successive rows Example Row 1 field1 Worksheets("Successor").Range("b2").Value = cboPositionID1 Row 2 field 1 Worksheets("Successor").Range("b3").Value = cboPositionID2 And so on. So - not too hard to program but also way more code then necessary. Something more elegant would be to have variables for: Cell row number & Field number (cboPositionID1 or 2 or 3....) Example: Worksheets("Successor").Range("bVarialble").Value = cboPositionIDVariable Can someone help me write that? Hope I have explained what I need Any help here will be appreciated. Thanks in advance dave |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Use variable in macro coding | Excel Discussion (Misc queries) | |||
Including a third variable in a point diagram by color-coding | Excel Discussion (Misc queries) | |||
"=ROW()-1" type of coding doesn't appear in a filter / is there coding that does? | Excel Programming | |||
Implant macro coding into ASP coding | Excel Programming | |||
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? | Excel Worksheet Functions |