Hi all thanks for looking at this and any help given much appreciated.
I have a multipage for (sites) on a customer userform the multipage has only page1 at design, on running depending on criteria (how many sites a customer has it adds further pages dynamically), I have done this by looping thru the sites and getting the detail on to original page1, then copying that page and pasting into a newly added page with a new reference, so if a customer has three sites it will find the first instance in my sites worksheet, add detail from that row to the page1 controls ( textboxes), then copy and paste controls to a new page and rename that page with site ref and also log the row value, then repeat procedure for next site.
This all works fine, but the problem I am having is if I change the info for a site I need it to update back to sheet, I have used this code to do that but although it runs without error and selects the right sheet it doesn't update the data in the sheet.
Basically this code copies the data from the active sheet back to page1 and then updates the info from there to the site worksheet but it doesn't?
Can someone help please here is my code for the updating part.
Private Sub SUPDATE_Click()
Dim SP As Double
Dim SROW As Long
Dim SPNAME As Variant
Dim SITE As Excel.Worksheet
Application.ScreenUpdating = False
Application.Workbooks("yesdatav2.xlsm").Sheets(4).Activate
Application.Workbooks("yesdatav2.xlsm").Sheets("sites").Select
Set SITE = Sheets(4)
SP = MultiPage2.Value getting index number for active page
SPNAME = MultiPage2.Pages(SP).Name getting ref (name) of active page
MultiPage2.Pages(0).Visible = True making page1 visible this is hidden normally
MultiPage2.Pages(SP).Controls.Copy
MultiPage2.Pages(0).Paste
SROW = MultiPage2.Pages(0).SROW.Text getting row value of site from previously stored row value in textbox when first copied
SITE.Cells(SROW, 3).Value = MultiPage2.Pages(0).SNAME.Value
SITE.Cells(SROW, 8).Value = MultiPage2.Pages(0).SADD1.Value
SITE.Cells(SROW, 9).Value = MultiPage2.Pages(0).SADD2.Value
SITE.Cells(SROW, 10).Value = MultiPage2.Pages(0).SCITY.Value
SITE.Cells(SROW, 11).Value = MultiPage2.Pages(0).SPCODE.Value
SITE.Cells(SROW, 5).Value = MultiPage2.Pages(0).SCONTACT.Value
SITE.Cells(SROW, 6).Value = MultiPage2.Pages(0).SPHONE.Value
SITE.Cells(SROW, 7).Value = MultiPage2.Pages(0).SEMAIL.Value
SITE.Cells(SROW, 13).Value = MultiPage2.Pages(0).SINFOS.Value
MultiPage2.Pages(0).Visible = false
End Sub
like iv said I get no errors it just doesn't change the data on the sites sheet.
Hope someone can help
I have a multipage for (sites) on a customer userform the multipage has only page1 at design, on running depending on criteria (how many sites a customer has it adds further pages dynamically), I have done this by looping thru the sites and getting the detail on to original page1, then copying that page and pasting into a newly added page with a new reference, so if a customer has three sites it will find the first instance in my sites worksheet, add detail from that row to the page1 controls ( textboxes), then copy and paste controls to a new page and rename that page with site ref and also log the row value, then repeat procedure for next site.
This all works fine, but the problem I am having is if I change the info for a site I need it to update back to sheet, I have used this code to do that but although it runs without error and selects the right sheet it doesn't update the data in the sheet.
Basically this code copies the data from the active sheet back to page1 and then updates the info from there to the site worksheet but it doesn't?
Can someone help please here is my code for the updating part.
Private Sub SUPDATE_Click()
Dim SP As Double
Dim SROW As Long
Dim SPNAME As Variant
Dim SITE As Excel.Worksheet
Application.ScreenUpdating = False
Application.Workbooks("yesdatav2.xlsm").Sheets(4).Activate
Application.Workbooks("yesdatav2.xlsm").Sheets("sites").Select
Set SITE = Sheets(4)
SP = MultiPage2.Value getting index number for active page
SPNAME = MultiPage2.Pages(SP).Name getting ref (name) of active page
MultiPage2.Pages(0).Visible = True making page1 visible this is hidden normally
MultiPage2.Pages(SP).Controls.Copy
MultiPage2.Pages(0).Paste
SROW = MultiPage2.Pages(0).SROW.Text getting row value of site from previously stored row value in textbox when first copied
SITE.Cells(SROW, 3).Value = MultiPage2.Pages(0).SNAME.Value
SITE.Cells(SROW, 8).Value = MultiPage2.Pages(0).SADD1.Value
SITE.Cells(SROW, 9).Value = MultiPage2.Pages(0).SADD2.Value
SITE.Cells(SROW, 10).Value = MultiPage2.Pages(0).SCITY.Value
SITE.Cells(SROW, 11).Value = MultiPage2.Pages(0).SPCODE.Value
SITE.Cells(SROW, 5).Value = MultiPage2.Pages(0).SCONTACT.Value
SITE.Cells(SROW, 6).Value = MultiPage2.Pages(0).SPHONE.Value
SITE.Cells(SROW, 7).Value = MultiPage2.Pages(0).SEMAIL.Value
SITE.Cells(SROW, 13).Value = MultiPage2.Pages(0).SINFOS.Value
MultiPage2.Pages(0).Visible = false
End Sub
like iv said I get no errors it just doesn't change the data on the sites sheet.
Hope someone can help
Last edited: