+ Reply to Thread
Results 1 to 24 of 24

VBA - combining cell according to the my condition.

  1. #1
    Registered User
    Join Date
    01-01-2015
    Location
    united kingdom
    MS-Off Ver
    2003
    Posts
    17

    VBA - combining cell according to the my condition.

    Can anyone Please look at my attach file. I need this.
    1) Take all the timeblocks and put them in an array. Place across Row 1 starting at column B.
    2) Take first petsitter (column E ) find all Morning visits and put them in the format Client (in capital) next line Service (without Parenthesis) next line Parenthisis Total Price (column L with only the dollar amount) / then Total ( column O with only dollar amount) closed Parenthisis. Each appointment should be seperated by a line.
    3) Place those walks under the morning column in the correct Petsitter row.
    4) Do instructions 2 & 3 for the rest of the Timeblocks.
    5) Go to the next Pet Sitter and do the same thing until all the walkers are done.
    6) Alternate rows with white and gray background.
    7) Make the Rows with the Headers for Timeblocks blue.
    8) Center everything
    Please look at summury sheet. I have done some row.
    Attached Files Attached Files
    Last edited by Nirupay Robi; 01-04-2015 at 01:38 PM.

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

    Re: VBA - combining cell according to the my condition.

    What do you need help with?
    Is the code you have not working?

  3. #3
    Registered User
    Join Date
    01-01-2015
    Location
    united kingdom
    MS-Off Ver
    2003
    Posts
    17

    Re: VBA - combining cell according to the my condition.

    Sir,
    I have tried to make this but failed. Please see my attach file named "failed file" I have done this but I need like the attach "TEST" file.

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: VBA - combining cell according to the my condition.

    I have written some code to produce the same result as sheet "Summary" but with a different format. This appears to work as shown in "Sheet1".
    If this is acceptable, I imagine you will also require this code to differentiate between Various Dates, with the same people. this code does not cater for this at the moment!!!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-01-2015
    Location
    united kingdom
    MS-Off Ver
    2003
    Posts
    17

    Re: VBA - combining cell according to the my condition.

    Everything is ok but command button is not working. how can run it. it is not working.
    Tell me how I will run it?

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

    Re: VBA - combining cell according to the my condition.

    The command button is on Cell A1, and it works for me.
    Did you Enable macros?

  7. #7
    Registered User
    Join Date
    01-01-2015
    Location
    united kingdom
    MS-Off Ver
    2003
    Posts
    17

    Re: VBA - combining cell according to the my condition.

    yes, but not working for me. showing error.

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

    Re: VBA - combining cell according to the my condition.

    Well what is the error? help us understand.
    Just don't say,"Doesn't Work", then expect us to know why.

  9. #9
    Registered User
    Join Date
    01-01-2015
    Location
    united kingdom
    MS-Off Ver
    2003
    Posts
    17

    Re: VBA - combining cell according to the my condition.

    when I click on command button nothing happen. If I run the code manually by pressing Alt+F8 then show error subscript out of range. I am using excel 2013.

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

    Re: VBA - combining cell according to the my condition.

    Did you copy the code to another workbook with different sheet names?

  11. #11
    Registered User
    Join Date
    01-01-2015
    Location
    united kingdom
    MS-Off Ver
    2003
    Posts
    17

    Re: VBA - combining cell according to the my condition.

    No, I have run the code in the same sheet. Can you please give me a new file with which you have run and working with you?

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

    Re: VBA - combining cell according to the my condition.

    http://www.excelforum.com/attachment...y-of-test.xlsm
    This is MickG's workbook, I stopped working on it when I saw he had a working solution.
    Open the workbook and enable macros
    Click the blue button

  13. #13
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: VBA - combining cell according to the my condition.

    Thanks for the help "DaveExcel".
    Here is another copy of the Workbook
    NB:- The sheet1 Results from running the code are already showing , so you need to delete them and the click the CommandButton in "A1", to show the results again !!!
    https://app.box.com/s/sh6v6l2599m2s3nwezz7

  14. #14
    Registered User
    Join Date
    01-01-2015
    Location
    united kingdom
    MS-Off Ver
    2003
    Posts
    17

    Re: VBA - combining cell according to the my condition.

    error messege subscript out of range"


    This line is showing wrong
    Set Dws = Sheets("Summary")
    you have mention "summary" but the sheet name is "sheet1"
    when I have changed summary to sheet1
    problem showing here

    cell.Select

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

    Re: VBA - combining cell according to the my condition.

    The button is an ActiveX control and so the code will be in the worksheet module, don't use the one in the regular module.
    Right click on the sheet tab and select View Code to see the code associated with the Command Button.

    Do you not see the Blue Button?

  16. #16
    Registered User
    Join Date
    01-01-2015
    Location
    united kingdom
    MS-Off Ver
    2003
    Posts
    17

    Re: VBA - combining cell according to the my condition.

    Yes, I can see you button when I click it nothing happen.

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

    Re: VBA - combining cell according to the my condition.

    Lets see your workbook, name it something else before you attach it.

  18. #18
    Registered User
    Join Date
    01-01-2015
    Location
    united kingdom
    MS-Off Ver
    2003
    Posts
    17

    Re: VBA - combining cell according to the my condition.

    see the attach file named "my problem"

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

    Re: VBA - combining cell according to the my condition.

    I don't know much else I can do but to fly over there and click the button for you.
    It would be a nice change considering it's -35c here today.
    Please see attached
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    01-01-2015
    Location
    united kingdom
    MS-Off Ver
    2003
    Posts
    17

    Re: VBA - combining cell according to the my condition.

    Sir, I appreciate you, unfortunately it's not working in my pc. Thanks for your help.

  21. #21
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: VBA - combining cell according to the my condition.

    Try this one.
    Attached Files Attached Files
    Remember what the dormouse said
    Feed your head

  22. #22
    Registered User
    Join Date
    01-01-2015
    Location
    united kingdom
    MS-Off Ver
    2003
    Posts
    17

    Re: VBA - combining cell according to the my condition.

    Thanks a lot sir, Finally it's working on my pc.
    Thank you very very much.

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

    Re: VBA - combining cell according to the my condition.

    I'm thinking it may be a ActiveX error.
    Look at this post from the other day.
    http://www.excelforum.com/excel-prog...ml#post3945503

  24. #24
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: VBA - combining cell according to the my condition.

    Yep. If the code is written on a machine with the updates, it won't work on one without (the sample workbook didn't work for me because my IT department are blessedly slow about such things) - so I rebuilt the sheet and switched it for a Forms button.

+ 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. Combining two separate if statements depending on a condition
    By rundrm in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-25-2013, 12:34 AM
  2. Macro for combining multiple sheets to one sheet with a condition
    By ashaanna88 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-19-2013, 05:18 AM
  3. open a comment to cell range upon true condition then removing comment on false condition
    By ferrum_equitis in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2012, 12:55 AM
  4. Select worksheet based on condition & populate cell based on condition
    By beth1069 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-19-2011, 01:27 PM
  5. Combining data in several rows if a condition is met.
    By kingcal in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-05-2011, 05:26 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