Help with userform

pwwato

New Member
Joined
Jun 10, 2017
Messages
40
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
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,215,064
Messages
6,122,936
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top