Hi all,
First time posting - I have already gotten a lot of my questions answered here - thanks!
The following code works great to save data from a userform to a database on a worksheet; where my control names are CTRL1, CTRL2 etc. But I haven't figured a way to adapt the code for activex controls I have put on another worksheet(sheet 6) in the same workbook. Any ideas how to loop thru? It does not recognise any combinations I've tried using say: sheet6.OleoObject("CTR" & i).value.
TIA
Sheets("DATABASE").Select
Range("A" & rw).Activate
'MsgBox "ACELL IS:" & ActiveCell
'Start loop to add data back to worksheet from userform
i = 1
For i = 1 To cntrl_num ' number of controls on userform
col = i 'equals column address
'and variable rw equals row address
'chosen = Cells(rw, 1)
If Me.Controls("CTRL" & i).Value = Cells(rw, col).Value Then
'MsgBox "skipping VALUE" & Me.Controls("CTRL" & i)
Else: Cells(rw, col).Value = Me.Controls("CTRL" & i).Value
End If
'Me.Controls("CTRL" & i).Enabled = False
Next i
MsgBox "Record is now updated."
Bookmarks