How to pass address(es) as parameters
Thanks for your help! I appreciate it.
--
Pat
"Dave Peterson" wrote:
Maybe...
Private Sub FormatEntry(myRange as Range)
With myRange
.Interior.ColorIndex = 20
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
End With
End Sub
You're passing a real range--not the address.
sub testme02()
dim testrng as range
call FormatEntry(worksheets(5).range("B30:g31"))
'or
set testrng = worksheets(5).range("B30:g31")
call formatentry(testrng)
end sub
Pat wrote:
I have a subroutine (below) that works by itself. I'd like to modify it to
receive address passed as parameters. How do I do that?
Private Sub FormatEntry()
Dim myRange As Range
Set myRange = Worksheets(5).Range("B30:G31")
With myRange
.Interior.ColorIndex = 20
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
End With
End Sub
--
Thanks!
Pat
--
Dave Peterson
|