VBA Help Please
Moderator: Moderators
VBA Help Please
What I want to do is to call(run) a subroutine from another subroutine that is on a different sheet.
Last edited by Positron on Sun Apr 27, 2008 11:24 pm, edited 1 time in total.
-
jeffslot
- Portablizer Extraordinaire
- Posts: 853
- Joined: Wed Jun 01, 2005 6:26 am
- Location: PA
- Contact:
Positron,
On Sheet two I made a sub procedure similar to below:
Then behind my command button on sheet one I used:
On Sheet two I made a sub procedure similar to below:
Code: Select all
Public Sub SayHello()
MsgBox "Hello World"
End SubI hope this is what you meant. This works for me.Private Sub CommandButton1_Click()
Call Sheet2.SayHello
End Sub
What I want to do is to call(run) a subroutine from another subroutine that is on a different sheet.
-
jeffslot
- Portablizer Extraordinaire
- Posts: 853
- Joined: Wed Jun 01, 2005 6:26 am
- Location: PA
- Contact:
Well If I
* select Tools-->Macro-->Record New Macro from the tool bar &
* click on OK to start the recording.
* Select any cell
* Right-click & select Format Cells from the pop up menu.
* Click on the Border Tab
* Click on the NONE preset.
* Click on OK to close the format cells dialog.
* Go to Tools-->Macro-->Stop Recording
* Go to the visual basic editor
* Double-click on the Module1 I can see code similar to:
I end up with the code that can remove the border of a cell. Of course you could always spruce up this code if you wanted, maybe use a with statement to cut down on redundant code, but it should still get the job done.
* select Tools-->Macro-->Record New Macro from the tool bar &
* click on OK to start the recording.
* Select any cell
* Right-click & select Format Cells from the pop up menu.
* Click on the Border Tab
* Click on the NONE preset.
* Click on OK to close the format cells dialog.
* Go to Tools-->Macro-->Stop Recording
* Go to the visual basic editor
* Double-click on the Module1 I can see code similar to:
Code: Select all
Sub Macro1()
Selection.Borders(xlDiagonalDown).Linestyle = xlNone
Selection.Borders(xlDiagonalUp).Linestyle = xlNone
Selection.Borders(xlEdgeLeft).Linestyle = xlNone
Selection.Borders(xlEdgeTop).Linestyle = xlNone
Selection.Borders(xlEdgeBottom).Linestyle = xlNone
Selection.Borders(xlEdgeRight).Linestyle = xlNone
Selection.Borders(xlInsideVertical).Linestyle = xlNone
Selection.Borders(xlInsideHorizontal).Linestyle = xlNone
End Sub