ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with returning a Range (https://www.excelbanter.com/excel-programming/337014-help-returning-range.html)

Newbie80[_15_]

Help with returning a Range
 

Need help with returning a Range.

Dim rng As Range

rng = copyARangeOfHours(11)

---------------------------------------------------------------------

Function copyARangeOfHours(lineNr)
Dim thisWb As Workbook
Dim rangeOfHours As Range

Set thisWb = ThisWorkbook
thisWb.Worksheets("Needs").Select
rangeOfHours = Range("C" & lineNr & ":N" & lineNr)

'my try of returning
copyARangeOfHours = rangeOfHours
End Function

I get the error msg object variable not se

--
Newbie8
-----------------------------------------------------------------------
Newbie80's Profile: http://www.excelforum.com/member.php...fo&userid=2594
View this thread: http://www.excelforum.com/showthread.php?threadid=39491



All times are GMT +1. The time now is 07:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com