PDA

View Full Version : Solved: Calling a Function and Resize



Opv
07-17-2010, 10:28 AM
Is it possible to call a function to get the desired number to use in a resize statement? For example, there is a function called getRows that defines the number of current data rows exist. I tried the following but it did not work.


Selection.Resize(getRows).Select

Bob Phillips
07-17-2010, 11:26 AM
That should work.

This worked for me



Sub ResizeIt()
Selection.Resize(getRows).Select
End Sub

Function getRows()
getRows = 5
End Function

Opv
07-17-2010, 11:52 AM
Your response caused me to see what I think might have been my problem. getRows was a subroutine rather than a function. After seeing your example, I changed it to a function and it works fine now. Thanks.