How to call Excel End function?

rorrisonrorrison Member Posts: 12
I'm trying to select the cells in a column that have something in them. From various sources I have put together:
XlRange := XlWorkSheet.Range('B3').End(-4121);  // -4121 = xlDown

However, when I try to compile this I get the error
A field from a record variable was expected. For example
Record.Field
Customer.Name
with the cursor right before the E of End. I'm guessing that it's interpreting "End" as a keyword, and complaining that there's something missing after the dot.

Is there a way to call the End function on an automation object, or some other way to do what I want?

Thanks,

Randy

Comments

  • SPost29SPost29 Member Posts: 148
    Hi,
    I haven't tried this but in the examples in excel help
    Range("B4").End(xlToRight).Select
    The Select is included
    Have you tried?

    XlRange := XlWorkSheet.Range('B3').End(-4121).Select;
  • rorrisonrorrison Member Posts: 12
    Yes, I started with that and removed the Select while trying to get it to work.
Sign In or Register to comment.