ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copying many controls (https://www.excelbanter.com/excel-programming/403119-copying-many-controls.html)

Charlie

copying many controls
 
I'm going to have many controls that get their values from sheet1, all on a
multipage. Then I'll have sheet2, & sheet3, and also pages on the multipage
that are identical to the first page, except they get their data from sheet2,
sheet3. Their are 40-50 controls each page, each page identical, just using
a different sheet, which are identical. Can I 'copy' one page to the next,
only changing the sheet that is referenced, rather than having to make the
sheet ref change on 40-50 controls?


joel

copying many controls
 
You may havve to write simple macro like the one below

Sub test3()

For Each shp In ActiveSheet.Shapes
If shp.Type = msoOLEControlObject Then
Link = ActiveSheet.OLEObjects(shp.Name).LinkedCell
Link = Replace(Link, "Sheet1", "Sheet2")
ActiveSheet.OLEObjects(shp.Name).LinkedCell = Link
End If
Next shp





"Charlie" wrote:

I'm going to have many controls that get their values from sheet1, all on a
multipage. Then I'll have sheet2, & sheet3, and also pages on the multipage
that are identical to the first page, except they get their data from sheet2,
sheet3. Their are 40-50 controls each page, each page identical, just using
a different sheet, which are identical. Can I 'copy' one page to the next,
only changing the sheet that is referenced, rather than having to make the
sheet ref change on 40-50 controls?



All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com