0

I get that error on this line

Selection.AutoFill Destination:=Range("BT & HighPeriod, :BT" & lastRow), _
    Type:=xlFillDefault

HighPeriod is an integer. Is it possible to use integers in both values of the Range.

0

1 Answer 1

2

It seems there's a typo in your code, you might want to test with:

Selection.AutoFill Destination:=Range("BT" & HighPeriod & ":BT" & lastRow), Type:=xlFillDefault

or

Selection.AutoFill Destination:=Range("BT" & HighPeriod, "BT" & lastRow), Type:=xlFillDefault

if you're sure about the rest.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for your answer. I've tested your suggestions, unfortunately I get the same error. This original line works: Selection.AutoFill Destination:=Range("BT119:BT" & lastRow), Type:=xlFillDefault, I'm trying to make the program more dynamic by replacing "119" with "HighPeriod". "119" is used at a lot of places in the program. Any more ideas? Best regards, Daniel
@vighurt if the code works with 119, then you have just fixed the problem of syntax I told you and highlighted a new one. We cannot help you if you dont show us how you define the variable HighPeriod
It's solved! Had to add HighPeriod+1. Thanks again and have a great weekend! /Daniel

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.