+ Reply to Thread
Results 1 to 12 of 12

Combine code together so columns Q,R,S & T instead of doing each column separate.

  1. #1
    Forum Contributor
    Join Date
    10-25-2016
    Location
    Derby, England
    MS-Off Ver
    MS 2013
    Posts
    228

    Combine code together so columns Q,R,S & T instead of doing each column separate.

    Hi,

    I was wondering if someone would help me please?

    I have a code that will only trigger the userform if all these columns values are met. I can get to work but I know I'm doing it the long winded way.

    Here is my code:

    Please Login or Register  to view this content.
    What I would like is to be able to combine the code into on simple code.

    Any help would be much appreciated.

    Kind Regards
    Dan

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Combine code together so columns Q,R,S & T instead of doing each column separate.

    What does the variable sValueA contain? Is it a number which is summing values in columns Q:T

    If so just have a check cell which adds these 4 totals together, checks for an overall total and then use that check cell in the macro to open the userform.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Combine code together so columns Q,R,S & T instead of doing each column separate.

    try:
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Combine code together so columns Q,R,S & T instead of doing each column separate.

    Other option:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-25-2016
    Location
    Derby, England
    MS-Off Ver
    MS 2013
    Posts
    228

    Re: Combine code together so columns Q,R,S & T instead of doing each column separate.

    Hi Kasper,

    Your code had a little typo at the end with the extra ) but I deleted it and now it seems to work.

    Thank you and also to Richard for replying, it is appreciated.

    Thanks again

    Dan

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Combine code together so columns Q,R,S & T instead of doing each column separate.

    Yeah, the second one (have you tested) have one closing parthenses missing So the countif(code,")") is just right (I also corrected comme (instead of dot).

    Please Login or Register  to view this content.
    That's the side effect of no attachment - If there was one, I'd test code myself, not only type it in "Quick answer" window.

    But I'm glad you managed it. And thanks for marking thread solved and for the reputation point.

  7. #7
    Forum Contributor
    Join Date
    10-25-2016
    Location
    Derby, England
    MS-Off Ver
    MS 2013
    Posts
    228

    Re: Combine code together so columns Q,R,S & T instead of doing each column separate.

    Hi Kasper,

    I've just tried your second option but I can't get it to work.

    When I try triggering the userform it comes up with "RUNTIME ERROR 424 - Object Required" and highlights this part of the code:

    Please Login or Register  to view this content.
    any ideas? No worries if not because I'm more than happy with your first suggestion.

    Thanks

    Dan

  8. #8
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Combine code together so columns Q,R,S & T instead of doing each column separate.

    one mor typo (too many today , surely I shall work only on attached files, or prepare dummy myself) sorry
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    10-25-2016
    Location
    Derby, England
    MS-Off Ver
    MS 2013
    Posts
    228

    Re: Combine code together so columns Q,R,S & T instead of doing each column separate.

    Hi Kasper,

    I'm sorry but its still not working. I've attached my file so hopefully you can find the reason why?
    Attached Files Attached Files

  10. #10
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Combine code together so columns Q,R,S & T instead of doing each column separate.

    Hi,
    made one more change - this time having file open .
    Please Login or Register  to view this content.
    Hope it works fine now.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    10-25-2016
    Location
    Derby, England
    MS-Off Ver
    MS 2013
    Posts
    228

    Re: Combine code together so columns Q,R,S & T instead of doing each column separate.

    Hi Kasper,

    yes that's sorted it. Thank you again for all your help.

    Kind Regards

    Dan

  12. #12
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Combine code together so columns Q,R,S & T instead of doing each column separate.

    Hi,

    You've written to me PM which seems to be continuation of this thread. Please describe your needs on the open forum (not in PM).
    If it's continuation related to the title: "Combine code together so columns Q,R,S & T instead of doing each column separate." write it here. If other descripion suits better - start new thread.

+ 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. Replies: 2
    Last Post: 08-03-2017, 10:21 AM
  2. use one value to combine 2 values from 2 separate columns
    By Mark_Delaware in forum Excel General
    Replies: 3
    Last Post: 02-03-2016, 06:04 PM
  3. Combine rows then split into separate columns
    By flexi1 in forum Excel General
    Replies: 2
    Last Post: 02-24-2015, 06:41 AM
  4. [SOLVED] Match Multiple Columns from Separate Sheet to get separate column.
    By gvitoro in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-19-2014, 03:38 PM
  5. Combine rows with duplicate values into separate columns
    By itgeekgroup in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-18-2014, 11:12 AM
  6. [SOLVED] VBA code to combine data from two different sheet columns and paste new sheet and column?
    By Chris* in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-16-2014, 03:15 AM
  7. How to combine separate columns in to single range
    By is49460 in forum Excel General
    Replies: 5
    Last Post: 05-20-2011, 10:45 AM

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