Hi guy thanks for taking the time to look at this and any help given.
I have a contact form that works well but what I am trying to do is on this form is, there are 2 multipages 1 for sites (multipage2) and 1 for lifts (multipage 3) and I want these to update depending on customer ref but also allow updating back to sheet, each customer may have multiple sites and lifts, so each multipage needs to add pages depending on amount and name the pages with a ref from the sheet. this code works well but my worry is will I be able to update any changes back to sheet doing it this way, and this only
does the site multisheet2 part can I do another for loop within this loop to do the lift part multipage3. hope that makes sense.
doPrivate Sub TEST_Click()
Application.ScreenUpdating = False
Application.Workbooks("yesdatav2.xlsm").Sheets("SITES").Activate
Application.Workbooks("yesdatav2.xlsm").ActiveSheet.Select
Dim msgval As String
Dim rg As Range
Dim Cl As Range
Dim Msg As String
Dim MSGR As String
Dim I As Integer
msgval = REF.Value 'InputBox("ENTER REF", "YES")
For Each Cl In Sheet4.Range("A1:A500")
If Cl.Value = msgval Then
Msg = Cl.Offset(, 1).Value & " Row " & Cl.Row
MSGR = Cl.Offset(, 1).Value
MultiPage2.Pages(0).SNAME.Value = Cl.Offset(, 3).Value
MultiPage2.Pages(0).SADD1.Value = Cl.Offset(, 8).Value
MultiPage2.Pages(0).SADD2.Value = Cl.Offset(, 9).Value
MultiPage2.Pages(0).SCITY.Value = Cl.Offset(, 10).Value
MultiPage2.Pages(0).SPCODE.Value = Cl.Offset(, 11).Value
MultiPage2.Pages(0).SCONTACT.Value = Cl.Offset(, 5).Value
MultiPage2.Pages(0).SPHONE.Value = Cl.Offset(, 6).Value
MultiPage2.Pages(0).SEMAIL.Value = Cl.Offset(, 7).Value
MultiPage2.Pages(0).SINFOS.Value = Cl.Offset(, 13).Value
Me.MultiPage2.Pages.Add (MSGR)
MultiPage2.Pages(0).Controls.Copy
MultiPage2.Pages(MSGR).Paste
'MsgBox Msg
End If
Next Cl
'MultiPage2.Pages(0).Visible = False I keep this page basically as a template for other pages.controls and then hide it once done although I do need to find a way of removing the extra pages once contact changed
End Sub
I have a contact form that works well but what I am trying to do is on this form is, there are 2 multipages 1 for sites (multipage2) and 1 for lifts (multipage 3) and I want these to update depending on customer ref but also allow updating back to sheet, each customer may have multiple sites and lifts, so each multipage needs to add pages depending on amount and name the pages with a ref from the sheet. this code works well but my worry is will I be able to update any changes back to sheet doing it this way, and this only
does the site multisheet2 part can I do another for loop within this loop to do the lift part multipage3. hope that makes sense.
doPrivate Sub TEST_Click()
Application.ScreenUpdating = False
Application.Workbooks("yesdatav2.xlsm").Sheets("SITES").Activate
Application.Workbooks("yesdatav2.xlsm").ActiveSheet.Select
Dim msgval As String
Dim rg As Range
Dim Cl As Range
Dim Msg As String
Dim MSGR As String
Dim I As Integer
msgval = REF.Value 'InputBox("ENTER REF", "YES")
For Each Cl In Sheet4.Range("A1:A500")
If Cl.Value = msgval Then
Msg = Cl.Offset(, 1).Value & " Row " & Cl.Row
MSGR = Cl.Offset(, 1).Value
MultiPage2.Pages(0).SNAME.Value = Cl.Offset(, 3).Value
MultiPage2.Pages(0).SADD1.Value = Cl.Offset(, 8).Value
MultiPage2.Pages(0).SADD2.Value = Cl.Offset(, 9).Value
MultiPage2.Pages(0).SCITY.Value = Cl.Offset(, 10).Value
MultiPage2.Pages(0).SPCODE.Value = Cl.Offset(, 11).Value
MultiPage2.Pages(0).SCONTACT.Value = Cl.Offset(, 5).Value
MultiPage2.Pages(0).SPHONE.Value = Cl.Offset(, 6).Value
MultiPage2.Pages(0).SEMAIL.Value = Cl.Offset(, 7).Value
MultiPage2.Pages(0).SINFOS.Value = Cl.Offset(, 13).Value
Me.MultiPage2.Pages.Add (MSGR)
MultiPage2.Pages(0).Controls.Copy
MultiPage2.Pages(MSGR).Paste
'MsgBox Msg
End If
Next Cl
'MultiPage2.Pages(0).Visible = False I keep this page basically as a template for other pages.controls and then hide it once done although I do need to find a way of removing the extra pages once contact changed
End Sub