A
antonsaitz
Hi,
I've got what appears to be an issue with the syntax for userform
control properties. It is probably a simple issue but I've tried
various ways of making it work to no avail. I keep getting errror
values for With my program to place values on a speadsheet based on the
control tag properties and offset function. I keep getting an error when
I try to set a variable to the range specified by the control tag.
Here is the whole code for populating the speadsheet and feeding back
to a validation page on the userform.
If anyone can please help me with this problem I would be greatly
appreciated!
Thank you,
Matt
Code:
--------------------
Private Sub CmdOK2_Click()
Sheet2.Select
Range("A1").End(xlDown).Select
LastFilledRowinRange = ActiveCell.Row
Dim Ctrl As Control
Dim Desticells As Range
Dim Sourcecells As Range
For N = 0 To 1
For Each Ctrl In Me.MultiPage1.Pages(N).Controls
If Ctrl.Tag <> "" Then
If Ctrl.Value <> False Then
Set Desticells = Range(Ctrl.Tag) 'Range 'global failed error
Desticells.Offset(LastFilledRowinRange, 0) = Desticells
If Ctrl.Value = True Then Range(Desticells).Value = Ctrl.TabIndex
If Ctrl.Value <> False Or "" Then Range(Desticells).Text = Ctrl.Text
End If
End If
Next Ctrl
Next N
For Each Ctrl In Me.MultiPage1.Pages(2).Controls
If Ctrl.Tag <> "" Then
Set Soucecells = Range(Ctrl.Tag)
Sourcecells.Offset(LastFilledRowinRange, 0) = Sourcecells
Range(Sourcecells).Text = Ctrl.Text
End If
Next Ctrl
Call Next_Button
End Sub
I've got what appears to be an issue with the syntax for userform
control properties. It is probably a simple issue but I've tried
various ways of making it work to no avail. I keep getting errror
values for With my program to place values on a speadsheet based on the
control tag properties and offset function. I keep getting an error when
I try to set a variable to the range specified by the control tag.
Here is the whole code for populating the speadsheet and feeding back
to a validation page on the userform.
If anyone can please help me with this problem I would be greatly
appreciated!
Thank you,
Matt
Code:
--------------------
Private Sub CmdOK2_Click()
Sheet2.Select
Range("A1").End(xlDown).Select
LastFilledRowinRange = ActiveCell.Row
Dim Ctrl As Control
Dim Desticells As Range
Dim Sourcecells As Range
For N = 0 To 1
For Each Ctrl In Me.MultiPage1.Pages(N).Controls
If Ctrl.Tag <> "" Then
If Ctrl.Value <> False Then
Set Desticells = Range(Ctrl.Tag) 'Range 'global failed error
Desticells.Offset(LastFilledRowinRange, 0) = Desticells
If Ctrl.Value = True Then Range(Desticells).Value = Ctrl.TabIndex
If Ctrl.Value <> False Or "" Then Range(Desticells).Text = Ctrl.Text
End If
End If
Next Ctrl
Next N
For Each Ctrl In Me.MultiPage1.Pages(2).Controls
If Ctrl.Tag <> "" Then
Set Soucecells = Range(Ctrl.Tag)
Sourcecells.Offset(LastFilledRowinRange, 0) = Sourcecells
Range(Sourcecells).Text = Ctrl.Text
End If
Next Ctrl
Call Next_Button
End Sub