variable problem error 424

  • Thread starter pjbur2005 via OfficeKB.com
  • Start date
P

pjbur2005 via OfficeKB.com

Not sure if i am getting this over very well but here goes

I have a list called "Datalables"

in this list i have a value ""AdmissionDate"

I have a range called "AdmissionDate"

I have a userform With all controls prefixed with "UF"

in the userform i use a variable called "UFAdmissionDate"

i loop through the "Datalabels" list if = "AdmissionDate" i want the range
"AdmissionDate" to be given the Value Of "UFAdmissionDate"

if value is not "AdmissionDate" then i get the value of the control called
"UF" & the list value.
M when i run this i get 424 error object required can someone see what i am
doing wrong

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"
' following line produces object required error 424
Worksheets("info").Range(field) = form.
Value
Case Else
Range(field) = .Controls(form).Value
End Select
Next
End With

End With
End With
End Sub
 
J

Jim Thomlinson

You have
form.value
but form is a variable and not an object so it does not have a value
property...

Try
Worksheets("info").Range(field) = form
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top