P
pjbur2005 via OfficeKB.com
Hi there hope some one can point me in the right direction. i dont seem to
be able to see the wood for the trees.
I have a userform that I use to collect input from users, i also populate it
from a data source. i use a list of field names that relate to both the range
names on a worksheet and with a prefix of "UF" to the userform both in terms
of controls and variables. I loop through the list and with the controls i
use Range(field) = .Controls(form).Value. how do i deal with the variables
"AdmissionDate", "DateTimeStamp" which in the code for the userform are
prefixed by "UF"
ie how do i pass the values to the relevant range
please see following code
Public Sub datatransfer()
With Workbooks("Cram")
.Activate
With Worksheets("info")
'cram is userform
With Cram
For Each field In Range("datalabels")
form = "UF" & field
Select Case field
Case "AdmissionDate", "DateTimeStamp"
'What do i use here?
Case Else
Range(field) = .Controls(form).Value
End Select
Next
End With
End With
End With
End Sub
many thanks in anticipation
be able to see the wood for the trees.
I have a userform that I use to collect input from users, i also populate it
from a data source. i use a list of field names that relate to both the range
names on a worksheet and with a prefix of "UF" to the userform both in terms
of controls and variables. I loop through the list and with the controls i
use Range(field) = .Controls(form).Value. how do i deal with the variables
"AdmissionDate", "DateTimeStamp" which in the code for the userform are
prefixed by "UF"
ie how do i pass the values to the relevant range
please see following code
Public Sub datatransfer()
With Workbooks("Cram")
.Activate
With Worksheets("info")
'cram is userform
With Cram
For Each field In Range("datalabels")
form = "UF" & field
Select Case field
Case "AdmissionDate", "DateTimeStamp"
'What do i use here?
Case Else
Range(field) = .Controls(form).Value
End Select
Next
End With
End With
End With
End Sub
many thanks in anticipation