+ Reply to Thread
Results 1 to 9 of 9

Request help with Case Statement and Merged Cells

  1. #1
    Registered User
    Join Date
    09-18-2006
    Posts
    14

    Request help with Case Statement and Merged Cells

    Hello,
    I have a piece of code that when a cell(in this case A1 or A2) has data nothing occurs, however if it is blank or the data is deleted, a diagonal line goes accross the cell, if you enter data, the line dissappears and the data stays and it can continuously do this. However this only works on a single cell, if I merge A1 with B2 then the code ceases to work correctly in that when the cell is blank or cleared the diagonal line doesn't appear anymore.

    In my application, I need the code to work on merged cells.
    Any help is greatly appreciated.
    ______________________
    Please Login or Register  to view this content.
    ____________________________________
    Last edited by VBA Noob; 01-04-2007 at 06:25 PM.

  2. #2
    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
    Hi,

    Code you use Centre across selection instead of merge??

    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 !!!

  3. #3
    Registered User
    Join Date
    05-02-2006
    Posts
    80
    Hi,

    I've tried out your code and it works on my computer fine. Even with merged cells.

    I has to change one bit though.

    Replaced the word blank with empty quotes ("") in lines 9 and 26. Don't know whether this is the reason it's not working on yours.

    Tris

  4. #4
    Registered User
    Join Date
    09-18-2006
    Posts
    14
    Quote Originally Posted by VBA Noob
    Hi,

    Code you use Centre across selection instead of merge??

    VBA Noob
    Hi thank you for replying

    I'm sorry I'm new at this, how do i Center across the selection?

  5. #5
    Registered User
    Join Date
    09-18-2006
    Posts
    14
    Quote Originally Posted by Tristan
    Hi,

    I've tried out your code and it works on my computer fine. Even with merged cells.

    I has to change one bit though.

    Replaced the word blank with empty quotes ("") in lines 9 and 26. Don't know whether this is the reason it's not working on yours.

    Tris
    Hi I tried what you stated above and i does not work for me. I did find out that it works if I hit the space bar and put a space in the cell and if I delete the space out the line stays.

  6. #6
    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
    Hi,

    Select Range A1:B1 then right click > format > alignment tab > drop down on Horizontal and select center across selection

    VBA Noob

  7. #7
    Registered User
    Join Date
    09-18-2006
    Posts
    14
    Quote Originally Posted by VBA Noob
    Hi,

    Select Range A1:B1 then right click > format > alignment tab > drop down on Horizontal and select center across selection

    VBA Noob
    Thank you sir, I just find that option right when you posted. The problem with using the center across selection is that the diagonal only goes into cell A1 with the code i'm using.

    You might ask next if I really need to merge the cells. With the nature of the sheet and it purpose, I need to merge the cells. With that in mind, the "center across selection" option opens too many cells that the user can input into. I basically need a group of cells to act like one and be able for the code previously described to work on it.

    Thank you for your assistance once again.

  8. #8
    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
    No problem.

    VBA Noob

  9. #9
    Registered User
    Join Date
    09-18-2006
    Posts
    14
    Something I decided to try to find out where the code was messing up was added diagonals to other cells in the code to identify where the code stopped working. Using the code below, I noticed that when i input something in A1, a diagonal goes across D1 E1 F1 as it should however, (after clearing the borders in D1 E1 F1 but keeping the data in A1) in deleting the contents of A1, only D1 gets a diagonal when D1 and E1 should. So at that point, the code stops before the case statement or before Case "$A$1".

    Please Login or Register  to view this content.
    Last edited by kys2000; 01-05-2007 at 06:23 PM.

+ 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