+ Reply to Thread
Results 1 to 6 of 6

Macro to change only cells where colorIndex =15

  1. #1
    Registered User
    Join Date
    05-15-2007
    Posts
    3

    Macro to change only cells where colorIndex =15

    update: I have pasted the whole subroutine at the bottom of this post please advise. Thanks.

    The if statement changes the whole spreadsheet format to m/d. However,
    I Need it to change only cells where colorIndex = 15. Please tell me what I am doing wrong here. Thanks. MC

    Please Login or Register  to view this content.
    Last edited by VBA Noob; 05-15-2007 at 04:16 PM.

  2. #2
    Forum Contributor stevebriz's Avatar
    Join Date
    09-07-2006
    Location
    Santiago Chile
    Posts
    389
    try this:
    you can change the range to my range

    Please Login or Register  to view this content.
    VBA - The Power Behind the Grid

    Posting a sample of your workbook makes it easier to look at the Issue.

  3. #3
    Registered User
    Join Date
    05-15-2007
    Posts
    3

    Here is the whole subroutine. Please help me.

    I tried the above code. It did not work. The message box did however display "If statement is True".
    Because the column ranges change per worksheet in the workbook. I could not hard code a range. I am using code to select the whole worksheet. In the worksheet there are random date rows and then number rows such as:

    6/5 6/6 6/7 6/8 <-- grey interior
    Tue Wed Thu Fri <--grey interior
    0 0 0 0/8
    8 0 0 0
    8 8 8/8 8
    8 8 0 8

    Some numbers are generated as date format, which I do not want if they are not meant to be a date because these are hours of employees. The worksheet is very large and I cannot monitor the way the user inputs the numbers. :-( Anyway, I will paste all my code in the bottom of this. Please your help is SOOOO appreciated. -Mitchell.
    Please Login or Register  to view this content.
    Last edited by mitchellCo; 05-15-2007 at 04:14 PM.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    mitchellCo,

    Please read forum rules below and then wrap your code otherwise this thread will be locked or deleted

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Forum Guru mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,206
    Your original code tried to treat Range(myRange) as one piece and do the same thing to it. This treats each cell in yourRange as individuals.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-15-2007
    Posts
    3

    Thumbs up Thanks!!

    Thanks mikerickson. I thought it was something like that but I couldn't find the right words or syntax.
    Thanks a lot!
    -MC

+ 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