+ Reply to Thread
Results 1 to 11 of 11

VBA to compare first columns of 2 workbook sheets as selected from inputbox

  1. #1
    Forum Contributor
    Join Date
    02-01-2008
    Location
    Perth, Australia
    MS-Off Ver
    Excel 365
    Posts
    135

    VBA to compare first columns of 2 workbook sheets as selected from inputbox

    Hi All,

    If possible can anyone assist me with correcting the below code.

    I am wanting the code to run where I can select 2 worksheets and compare the first column of both sheets where the differences are highlighted in sheet 4.

    The code to compare the sheets works perfectly but I cant select the sheets via the inputboxes.

    Preferably the inputbox would be populated by either clicking the required sheet Tab or via a dropdown showing the workbook tabs.

    Please Login or Register  to view this content.
    Any help is appreciated.

    Thanks,

    Adam

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,443

    Re: VBA to compare first columns of 2 workbook sheets as selected from inputbox

    Hi and welcome
    although we value privacy as much as anyone else, it could be important that members have a rough idea of your location. You might , for example, in the future post questions which are bound to your regional settings.
    So, please update your profile ( country will suffice, no need to be more precise).
    Thank you for helping us to help you

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,443

    Re: VBA to compare first columns of 2 workbook sheets as selected from inputbox

    Please update your profile as necessary to properly reflect the exact version(s) of Excel your question relates to. Members tailor answers based on your Excel version. Your profile does not indicate your XL version

  4. #4
    Forum Contributor
    Join Date
    02-01-2008
    Location
    Perth, Australia
    MS-Off Ver
    Excel 365
    Posts
    135

    Re: VBA to compare first columns of 2 workbook sheets as selected from inputbox

    Thanks Pepe,

    Updated.

    Cheers

  5. #5
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    995

    Re: VBA to compare first columns of 2 workbook sheets as selected from inputbox

    Preferably the inputbox would be populated by either clicking the required sheet Tab or via a dropdown showing the workbook tabs.
    1. Clicking the required sheet Tab
    You need to set the Application.InputBoxt to Type:=8, i.e Range as the input. And you need to select a cell (any cell) in the intended sheet (not just clicking the tab name).
    Try this:

    Please Login or Register  to view this content.
    2. via a dropdown showing the workbook tabs
    You need a userform & combobox, let me know if you prefer this method.

  6. #6
    Forum Contributor
    Join Date
    02-01-2008
    Location
    Perth, Australia
    MS-Off Ver
    Excel 365
    Posts
    135

    Re: VBA to compare first columns of 2 workbook sheets as selected from inputbox

    Thanks Akuini,

    That works.

    Is there any way to select the sheet but have the cell value A1 added in the inputbox so as not to have to select the cell?

    Cheers

  7. #7
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    995

    Re: VBA to compare first columns of 2 workbook sheets as selected from inputbox

    Is there any way to select the sheet but have the cell value A1 added in the inputbox so as not to have to select the cell?
    Sorry, I don't know how to do that.

  8. #8
    Forum Contributor
    Join Date
    02-01-2008
    Location
    Perth, Australia
    MS-Off Ver
    Excel 365
    Posts
    135

    Re: VBA to compare first columns of 2 workbook sheets as selected from inputbox

    All good,

    I appreciate your help.

    Cheers,

  9. #9
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    995

    Re: VBA to compare first columns of 2 workbook sheets as selected from inputbox

    You're welcome, glad to help, & thanks for the feedback.

  10. #10
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    995

    Re: VBA to compare first columns of 2 workbook sheets as selected from inputbox

    I forget something, you may need to add an error handling, because if you cancel the inputbox or insert something that isn't a range then it will raise an error.
    The error handling could be like this:

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    02-01-2008
    Location
    Perth, Australia
    MS-Off Ver
    Excel 365
    Posts
    135

    Re: VBA to compare first columns of 2 workbook sheets as selected from inputbox

    Thanks Akuini

+ 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. Inputbox with password to hide/unhide specific sheets in workbook.
    By Tona in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2015, 07:41 AM
  2. Importing defined columns from selected workbook sheets
    By Aurbo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-26-2015, 08:38 PM
  3. Replies: 1
    Last Post: 03-15-2014, 05:44 AM
  4. [SOLVED] Merging selected sheets with selected columns into another sheet
    By harry_1805 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2013, 01:51 PM
  5. [SOLVED] Is there any way to switch among different sheets in a workbook while an inputbox is popped?
    By lvcha.gouqizi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-02-2005, 06:20 PM
  6. Replies: 1
    Last Post: 11-02-2005, 06:17 PM
  7. Compare columns in 2 sheets in the same workbook and copy HELP NEEDED
    By ktab in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-22-2005, 08:23 AM

Tags for this Thread

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