View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
gordom gordom is offline
external usenet poster
 
Posts: 14
Default Placing a regular excel function in VBA code [HOW?]

W dniu 2009-03-10 17:43, Rick Rothstein pisze:
Give the code a try...

Sub Macro4()
On Error Resume Next
PrintAddr = "$A$1:$E$" & Range("A1:A40").Find("abc").Row
If Err.Number = 0 Then
ActiveSheet.PageSetup.PrintArea = PrintAddr
Else
MsgBox "The text ""abc"" did not appear in the specified range!"
End If
End Sub

It works super, thanks :-)