Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use variable in macro coding bmurlidhar Excel Discussion (Misc queries) 3 July 17th 09 10:37 AM
Including a third variable in a point diagram by color-coding Celia Excel Discussion (Misc queries) 1 January 29th 08 04:47 PM
"=ROW()-1" type of coding doesn't appear in a filter / is there coding that does? StargateFan[_3_] Excel Programming 10 October 6th 05 01:18 PM
Implant macro coding into ASP coding Sam yong Excel Programming 5 September 15th 05 10:37 AM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM


All times are GMT +1. The time now is 02:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"