VBA compiler error command offset

JohnBrennan

New member
when I try to compile .Offset(, 1) gives an error ? WHY ??? Is offset not supported ? Syntax error on 1 in the bracket (red line underneath)

Set rngNumbers = Range(“B2”, Cells(Rows.Count, “A”).End(xlUp).Offset(, 1)
var = Application.Transpose(rngNumbers.Offset(, -1))
Range(“G2:G” & Rows.Count).ClearContents
 
Last edited:
May I email it to you - I need some help to get the macro protected -will buy software if I can get macro protected as its the heart of my sheet.Plse advise
 
Last edited:
Your code looks strange. Even in VBE it triggers errors. Please check it.
To access all Excel objects, you must generally put Application. before. For instance, Application.Range(...)
 
Copy this in your compiler and see what I say…works flawless in VBA but NOT in your compiler

Set rngNumbers = Range(“B2”, Cells(Rows.Count, “A”).End(xlUp).Offset(, 1))
var = Application.Transpose(rngNumbers.Offset(, -1))
Range(“G2:G” & Rows.Count).ClearContents
error2
 
Last edited:
Ok noted I have emailed you the whole Macro SampleNew -I need to get it protected -the macro is called GetCombosReversed

Looking for your reply on your contact email -info@

Thank you
John
 
The problem comes from the syntax parsing here:
Set rngNumbers = Range(“B2”, Cells(Rows.Count, “A”).End(xlUp).Offset(, 1))

The compiler has a mismatch because it doesn’t recognize End as being an object but rather it expects End XXX such as End Sub. We’ll try to fix that in a future release.
Otherwise, for Offset(, 1), you should replace with Offset(0, 1)
 
Back
Top