reference cell in macro

  • Re: reference cell in macro


    range("A1")


    to select:
    range("A1").select


    HTH

    Cheers
    ___________
    Xlite :sheep:
    [st]All you need to learn VBA is an internet connection and Ozgrid.com[/st]

  • Re: reference cell in macro


    sheets("Sheet2").range("A1").select 'different sheet
    :)

    Cheers
    ___________
    Xlite :sheep:
    [st]All you need to learn VBA is an internet connection and Ozgrid.com[/st]

  • Re: reference cell in macro


    sorry zotee,


    made a mistake, it should be:

    Code
    Sheets("Sheet2").Activate
    Range("A1").Select


    Dave's code is more efficient though :smile:
    in case you have renamed the sheet:

    Code
    Application.GoTo Sheets("mysheet").Range("A1"), True

    Cheers
    ___________
    Xlite :sheep:
    [st]All you need to learn VBA is an internet connection and Ozgrid.com[/st]

  • Re: reference cell in macro


    I Am Now Running Into A Problem With The Cell Color. I Am Using Data Valadation And The Code I Am Using Only Works If You Hit The Enter Key. So When You Are Using Data Valadation With Drop Downs It Doesnt Work. Any Ideas?


    Thanks In Advance.

  • Re: reference cell in macro


    Just to summarize and add to the previous posts


  • Re: reference cell in macro


    Quote from zotee98

    Do You Have Any Thoughts On How To Color Code The Cell When Using Data Valadation?



    Try using Format --> Conditional Formatting within Excel (non Visual Basic method)

    You can have the color of a cell change when its within values (conditions) that you specify. This is what you probably want in addition to the Data Validation function you are describing.

  • Re: reference cell in macro


    Mike


    That Wont Work Because The Row Highlighter That I Am Using Uses Conditional Formating. Also I Need More Then Three Formats.

  • Re: reference cell in macro


    Quote from zotee98

    Mike


    That Wont Work Because The Row Highlighter That I Am Using Uses Conditional Formating. Also I Need More Then Three Formats.


    Zotee,
    Could you describe your problem more or post an example file as an attachment? Your question has grown a bit more than just referencing cell A1. It sounds like you might have to take a step back from using the Excel worksheet functions like Conditional Formatting and Data Validation and write a strictly Visual Basic way logic to do what needs to be done. I say this because you say you need more than three conditions to check against (exceeding the limit of Conditional Formatting). But where there is a will, there is a often a way to do something with the worksheet functions. Have you considered using Hidden columns of data on which to check extra conditions, using IF logic statements (you can nest up to seven conditions with the IF logic)?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!