Multi controls code
Thanks Stefi.
The code is:
' Step 1 - go over spreadsheets and verify if it is visible. if not - go on.
If Me.Spreadsheet1.Visible = True Then
x = 2
Do Until Me.Spreadsheet1.Cells(x, 1).Value = ""
Y = 2
Do Until Me.Spreadsheet1.Cells(1, Y).Value = ""
Me.Spreadsheet1.Range("A" & x).Value = Me.Spreadsheet1.Range("A"
& x).Value & Me.Spreadsheet1.Cells(x, Y).Value
Y = Y + 1
Loop
x = x + 1
Loop
End If
' Step 2 - If spreadsheet is visible verify if changes were done. if not -
go on.
x = 3
Do Until Me.Spreadsheet1.Range("A" & x).Value = ""
If Me.Spreadsheet1.Range("A2").Value = Me.Spreadsheet1.Range("A" & x).Value
Then
Me.Spreadsheet1.Range("A2").Value = "No change"
GoTo Step3
Else
Me.Spreadsheet1.Range("A2").Value = "New"
x = x + 1
End If
Loop
Step3:
This code should be duplicated for the rest spreadsheet2-7 unless it could
be modified.
Eli
"Stefi" wrote:
You should apply a structure like this:
Private Sub CommandButton1_Click()
Call sameprocess("spreadsheet1")
End Sub
Private Sub CommandButton2_Click()
Call sameprocess("spreadsheet2")
End Sub
... to spreadsheet8
Sub sameprocess(currsheetname As String)
Worksheets(currsheetname).Select
'...
End Sub
Give more details for a more specific answer!
--
Regards!
Stefi
אלי ezt *rta:
Hi!
I have on a userform 8 spreadsheet activeX controls, and I want all of them
to do the same thing. Do I have to write the same code 8 times or there is a
way to do it only once. The names a spreadsheet1, 2......8.
Thanks in advance
Eli
|