+ Reply to Thread
Results 1 to 9 of 9

Color a Range of Cells

  1. #1
    Registered User
    Join Date
    08-12-2004
    Posts
    45

    Color a Range of Cells

    Hi

    I have been tinkering around trying to figure this out and to be quite honest got nowhere really.

    I have code (recycled) in Access that loops through a query and generates a budget file for each person.

    I would like to colour a range of cells based on the number of rows in the sheet, some people may have more clients than other. The cells have no data and the colouring is to lead people to which cells they need to enter data into.

    The code I have so far is below, its a work in progress as I tidy up along the way, however this is the first part I have no idea on.

    Please Login or Register  to view this content.
    Anything you can offer is appreciated.

    Rob

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523

    Re: Color a Range of Cells

    Sorry Got carried away cleaning up, what's the question again, I am not sure if you are running this through excel or through access.

    Please Login or Register  to view this content.
    Last edited by davesexcel; 07-04-2010 at 04:19 PM.

  3. #3
    Registered User
    Join Date
    08-12-2004
    Posts
    45

    Re: Color a Range of Cells

    Thanks for the tidy up - always good to learn a few things.

    The code runs in access to produce a neatly formatted (allegedly) Excel file which attachs to an Outlook message and sends.

    My "open" question is that each file contains a varying amount of rows and I want to color a range highlighting what people need to fill in.

    In one file the range would be G4:G24 another one G4:G99 where G99 and G24 are the last row in the file with data.

    My problem is how do I get the the G24 and G99?

    Thanks again


    Rob

  4. #4
    Registered User
    Join Date
    08-12-2004
    Posts
    45

    Re: Color a Range of Cells

    Double Post -apologies

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523

    Re: Color a Range of Cells

    If the data is in column G then this will color column H
    Please Login or Register  to view this content.
    or if you want column G colored
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-12-2004
    Posts
    45

    Re: Color a Range of Cells

    Thanks - I can't have a button click as this code runs in access - however I will playaround with your offset to see where that takes me.

    I never open the files directly in Excel, its fully automated in Access ( or it will be when I have finished ).

    250 Excel files

    Thanks for quick response.

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523

    Re: Color a Range of Cells

    That's just the macro name.
    Usually when you see submitted code with the sub button_click people start by making a button, assign macro,new. From there they can write the code, go back to the sheet click the button to test it.
    Last edited by davesexcel; 07-05-2010 at 07:37 PM.

  8. #8
    Registered User
    Join Date
    08-12-2004
    Posts
    45

    Re: Color a Range of Cells

    Quote Originally Posted by davesexcel View Post
    What?
    That's just the macro name.
    Usually when you see submitted code with the sub button_click people start by making a button, assign macro,new. From there they can write the code, go back to the sheet click the button to test it, jeesh..
    Apologies my misunderstanding

  9. #9
    Registered User
    Join Date
    08-12-2004
    Posts
    45

    Re: Color a Range of Cells

    Thanks for your time and effort unfortunately the solution below did not work for 2nd file on.

    Fist file was perfect 2nd failed as "Set r = Range("G4", Range("G65536").End(xlUp))" I did some googling and found that other experienced this issue when using access to create XL files.

    I came up with an alternative method which given access knows how many records are in the resultant query send that variable through "RowCount" so I ended up with .Range("A2:A & RownCount)........

    Thanks for again for your time and patience

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1