w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
excel macro using variable to define range of a integer failure

If the content of Cells(LastRow, 2) is not a valid cell reference (like B3 is), the method will fail.

If you want to use the address of .Cells(LastRow, 2), then replace it with .Cells(LastRow, 2).Address(rowabsolute:=False, columnabsolute:=False).

EDIT: You could also use .Address with no parameter but you would get something like $A$1 (absolute referencing).

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.