简体   繁体   中英

Excel: Can offset use a named value?

How can I get the offset function to use the myRange value that was established earlier?

Specifcally, I have a value myRange that is (num of days in month + 3), so that the formula accounts for the number of days in a month and appears on the correct line. Later, I am trying to use the value of myRange in the offset function but when I hover over it, it returns: myRange = 0 . When I go into the name manager, I can see myRange and it has a value (34 in this case) and it referes to a specific cell and is scoped for the workbook. Any help would be greatly appreciated.

ActiveCell.FormulaR1C1 = "=numDays+3"
ActiveCell.NumberFormat = "General"    
ActiveCell.Name = "myRange"
Range("A1").Select
ActiveCell.Offset(0, 1).Select
While ActiveCell.Value <> Empty
    ActiveCell.Offset(myRange, 0).Select
    ActiveCell.FormulaArray = "=SUM((WEEKDAY(startDate:endDate)=3)*(R[-32]C:R[-2]C<>""""))"
    ActiveCell.Offset(0, 1).Select
Wend
 ActiveCell.Offset([myRange], 0).Select

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM