+ Reply to Thread
Results 1 to 17 of 17

Userform problems with merged worksheet cells

  1. #1
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Userform problems with merged worksheet cells

    Hi,

    I have Userform and It worked fine, but now I included merged cells on worksheet and nothing works anymore. Userfrom is for employees work schedule.

    Userform has combobox to select a day in month, and then listbox gets filled with data for that day.

    First problem is that when selecting index from Combobox, worksheet should move to a selected day to left side of Userfom. It worked, but now merged cells are problem.

    Second problem is that listbox doesn't show entries properly. Under label ""Job title" there should entries for each employee, now It shows only entry for first one.

    And third problem is that I don't know how to fill listbox with start/end values, that should be under "Start/End" label. For now I only have Start time in listbox, but there should be both together like "06:00-14:00". I tried with this but not working:

    Please Login or Register  to view this content.


    I also noticed that Combobox doesn't show names correctly, 1st of month is listed twice, with different days

    Any help appreciated, thanks in advance !!
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    re: Userform problems with merged worksheet cells

    The first thing you should do is get rid of the merged cells, starting with row 2.

    If you want the date to appear centred across two cells, eg E2:F2, then use the Center across selection horizontal alignment.

    Another thing you might want to look at is the dates you have in row 2, they start with 1 Jan 2014, then go 2 Jan 1900, 3 Jan 1900,..., 31 Jan 1900.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    re: Userform problems with merged worksheet cells

    Hi Norie,

    merged cell in Row 2 must remain, as I allready have macro for creating months with merged cells, I don't want to change that.

    Didn't notice about different dates, this is only a sample. But If you change first day to 1 Jan 1900, combobox still shows incorrectly.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    re: Userform problems with merged worksheet cells

    As far as I can see the merged cells are at the root of most of the problems you've listed.

  5. #5
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    re: Userform problems with merged worksheet cells

    Yes they are, but unfortunatelly I can't change that, only with VBA maybe, for time of opening Userform. Do you have any suggestions maybe ? Or show in sample what you meant with center across selection, maybe I can change macro for creating months ?

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    re: Userform problems with merged worksheet cells

    I'm afraid not, and I really don't see why you can't get rid of the merged cells.

    It would make everything a lot easier.

  7. #7
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    re: Userform problems with merged worksheet cells

    Ok,

    I changed to across selection, but still nothing works. See attached sample !
    Attached Files Attached Files

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    re: Userform problems with merged worksheet cells

    I also changed to Center across selection using a small sub called FillMonth

    The only other things I changed were the code to populate the combobox and the code for the hours.

    Oh, and I removed some of the conditional formatting but replaced some of it with code.

    See the attached file.

    PS I wasn't able to incorporate the formatting for the holidays as I couldn't find the relevant named range.
    Attached Files Attached Files
    Last edited by Norie; 05-28-2014 at 05:45 PM.

  9. #9
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    re: Userform problems with merged worksheet cells

    Thanks,

    I will check this solution, I hope It will work with my macro for creating months. Don't bother about holidays, I didn't include It in sample. I will let you know If everything works.

    Thanks again !!

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    re: Userform problems with merged worksheet cells

    Why not take a look at the code I used to create a month worth of dates, without merged cells?

  11. #11
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    re: Userform problems with merged worksheet cells

    Hi Luka,

    I think I was able to address all your known problems in your original file with the 'Merged Cells' based on the following assumptions:
    a. Dates must be fixed at the top of Sheet1 (dates are for 1900 and should be 2014).
    b. Job Titles are only displayed on the 1st day of the month and not for each day.
    c. When a time is 0:00, display for that time on the UserForm should be blank.

    Lewis

    Changes in red:
    Please Login or Register  to view this content.

  12. #12
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    re: Userform problems with merged worksheet cells

    Hi Luka,

    You might want to try adding the following code, that will do the following when you 'Double Click' on a column in a 'Month' Worksheet:
    a. Set the focus (top left cell) on row 2 for that date
    b. Open up UserForm1 with data for that date.

    Lewis

    To implement this you need to add the following:

    Add the following code to the UserForm1 module:
    Please Login or Register  to view this content.
    Add the following code to the Sheet1 module. When you create new months, the code will automatically replicate in the Sheet for each month.
    Please Login or Register  to view this content.
    Add the following in a NEW Ordinary Code module:
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    re: Userform problems with merged worksheet cells

    Hi LJMetzger,

    I tried your code & prefer your solution much better. Just one problem:

    a. When you enter some data in first day, that data is showed always on Listbox (except Start/End values) - I want Listbox to show data only for selected day in combobox. It works for first day, but not for other days.

    I like your "double-click" event, looks like I'm going to delete cmdbuttons for Userform.

    I applied your code in this sample, check It yourself ! I added "Refresh" button !
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    re: Userform problems with merged worksheet cells

    Looks like this line was a problem :

    Please Login or Register  to view this content.
    I commented It, and now It works. What have I missed, will that affect something else not to work ?

  15. #15
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Userform problems with merged worksheet cells

    Hi Luka,

    I apologize for not testing my previous file enough. I think this file will fix the problems you had. I made changes to the following modules in the
    attached file in an attempt to simplify, and increase capabilitites:
    a. ThisWorkbook
    b. Sheet1
    c. UserForm1 and UserForm1 code
    d. Module2

    Added items include:
    a. Automatic Refresh when a time value or Job is changed. Manual refresh required for Name change.
    b. Locked the top (dates) and left side (names) [and made row 1 hidden]
    c. Simplified Refresh and added comments. It is now the only routine that updates the list box.
    d. Added command buttons to UserForm to shift the dates on the spreadsheet to the left or right.


    Please Login or Register  to view this content.
    The above code from your last question should put the 'Job' in the list box.
    Please Login or Register  to view this content.
    Lewis
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: Userform problems with merged worksheet cells

    Hi Lewis,

    again you did a lot of work

    I checked all your code, but I have allready made Userform as told in previous post, and It suits my needs. About this :

    a. Automatic Refresh when a time value or Job is changed. Manual refresh required for Name change.
    b. Locked the top (dates) and left side (names) [and made row 1 hidden]
    d. Added command buttons to UserForm to shift the dates on the spreadsheet to the left or right.
    I love It & I will include It in my Userform, specially automatic refresh

    thanks for all your help !!

  17. #17
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Userform problems with merged worksheet cells

    I was happy to help. Your project has lots of interesting aspects to it. I figured you would use what you liked and/or could use, and not use other things which is fine.

    Thanks for the rep points.

    Lewis

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Problems with loop and cells merged
    By sylvain133 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2013, 06:03 AM
  2. [SOLVED] Userform entry to output into merged cells including nextrow outputs
    By Orestees in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 10-18-2012, 04:20 PM
  3. Replies: 6
    Last Post: 05-18-2012, 06:30 AM
  4. [SOLVED] how do i link merged cells to a merged cell in another worksheet.
    By ibbm in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-27-2006, 06:45 PM
  5. Replies: 1
    Last Post: 06-22-2005, 06:19 PM

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