+ Reply to Thread
Results 1 to 26 of 26

Find & replace the data with Msgbox

  1. #1
    Forum Contributor
    Join Date
    05-10-2020
    Location
    india
    MS-Off Ver
    2013
    Posts
    221

    Find & replace the data with Msgbox

    Hi,
    I am looking for a macro that does the things mentioned below
    macro will be placed in macro.xlsm & book1.xlsx is located at different place so the path should be hardcoded in the macro & sheet name can be anything

    I need a msgbox & in that msgbox I will put what we have to find in book1.xlsx & after finding that data we have to replace it with the data & for that also i need a msgbox & i will put the data in that msgbox & data will be replaced in book1.xlsx

    In Book1.xlsx we have to look in sheet1(sheet1 will be hardcoded in the macro so that i can change it as per my needs)
    In Book1.xlsx in sheet1 we have to find the data in Column A(Column A should be hardcoded in the macro so that i can change it as per my needs)



    Thnx For the Help

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find & replace the data with Msgbox

    msgbox can NOT accept input data. however, INPUTBOX() can. if you use the latter, and you want to find and replace data in column ''A'', you might want to look into the .column property of the range object. see here:

    https://docs.microsoft.com/en-us/off...l.range.column

    and when you use that, you can also use the find method in conjunction with that to find anything in a given column. and when you do that, you can then replace it appropriately.

    https://docs.microsoft.com/en-us/off...cel.range.find

  3. #3
    Forum Contributor
    Join Date
    05-10-2020
    Location
    india
    MS-Off Ver
    2013
    Posts
    221

    Re: Find & replace the data with Msgbox

    Thnx for the info vba_php , So i need inputbox instead of msgbox

  4. #4
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find & replace the data with Msgbox

    Yes that's correct you need to use an input box and not a message box

  5. #5
    Forum Contributor
    Join Date
    05-10-2020
    Location
    india
    MS-Off Ver
    2013
    Posts
    221

    Re: Find & replace the data with Msgbox

    I never used any inputbox before & i dont how to create it so plz help Sir

  6. #6
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find & replace the data with Msgbox

    It's very simple if you use a message box, this is your code:
    Please Login or Register  to view this content.
    And if you use an input box this is your code:
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    05-10-2020
    Location
    india
    MS-Off Ver
    2013
    Posts
    221

    Re: Find & replace the data with Msgbox

    No Problem
    But plz help me in solving this macro
    I dont know much about vba + I never used any inputbox, It is slightly new for me so plz have a look into it

  8. #8
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find & replace the data with Msgbox

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    05-10-2020
    Location
    india
    MS-Off Ver
    2013
    Posts
    221

    Re: Find & replace the data with Msgbox

    I dont want to harcode what i have to find & what i have to replace in the macro

    Bcoz it can be anything
    So some msgbox like that is needed for that so that when the macro will run that will pop up & will ask what i have to find &will ask with which data it should be replaced like that i am looking for

  10. #10
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find & replace the data with Msgbox

    Quote Originally Posted by dumdumbum View Post
    So some msgbox like that is needed for that so that when the macro will run that will pop up & will ask what i have to find &will ask with which data it should be replaced like that i am looking for
    i just gave you that

  11. #11
    Forum Contributor
    Join Date
    05-10-2020
    Location
    india
    MS-Off Ver
    2013
    Posts
    221

    Re: Find & replace the data with Msgbox

    Sorry vba_php, My mistake
    Actually plz see the below macro & plz correct the below macro, it has errors
    I modified the macro as per my needs bcoz the data which we have to find & replace is with different workbook & macro will be placed in different workbook
    So plz have a Relook Sir


    Please Login or Register  to view this content.

  12. #12
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find & replace the data with Msgbox

    you say it has errors. where does it break? where does it error? the only thing i can possibly see as an issue is the line where the replacement is happening. those 3 lines of code will manipulate the worksheet that has the FOCUS.

  13. #13
    Forum Contributor
    Join Date
    05-10-2020
    Location
    india
    MS-Off Ver
    2013
    Posts
    221

    Re: Find & replace the data with Msgbox

    Correct Sir, Yes from there only there is a issue

  14. #14
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find & replace the data with Msgbox

    I see no issue. upload a file that has an error in it.

  15. #15
    Forum Contributor
    Join Date
    05-10-2020
    Location
    india
    MS-Off Ver
    2013
    Posts
    221

    Re: Find & replace the data with Msgbox

    Macro will be placed in macro.xlsm & the second file i have attached below
    Attached Files Attached Files

  16. #16
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find & replace the data with Msgbox

    there is no code in you workbook

  17. #17
    Forum Contributor
    Join Date
    05-10-2020
    Location
    india
    MS-Off Ver
    2013
    Posts
    221

    Re: Find & replace the data with Msgbox

    Macro will be placed in macro.xlsm Sir
    Macro i already shared & plz place the macro to a newe file & run the macro Sir & then see the issue Sir

  18. #18
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find & replace the data with Msgbox

    you know, what I'm trying to tell you is to run the macro yourself and see what it gets you. do you not want to do that? just tell me that, and I'll do it. I don't know if you realize this or not, but this is extremely simple. and I already gave you the answer that works fine.

  19. #19
    Forum Contributor
    Join Date
    05-10-2020
    Location
    india
    MS-Off Ver
    2013
    Posts
    221

    Re: Find & replace the data with Msgbox

    Run Time Error:1004
    application defined or object defined error
    Highlighted line:

    Columns("A:A").Replace What:=s, Replacement:=s2, LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
    Attached Images Attached Images

  20. #20
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find & replace the data with Msgbox

    I downloaded your file, put the code into it that I *wrote*, and I got no error. see images:
    Attached Images Attached Images
    Attached Files Attached Files

  21. #21
    Forum Contributor
    Join Date
    05-10-2020
    Location
    india
    MS-Off Ver
    2013
    Posts
    221

    Re: Find & replace the data with Msgbox

    Macro will not be placed in leverage file, macro will be in different file

  22. #22
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find & replace the data with Msgbox

    I know that. but your workbooks.open() method of line of code was not what was failing, according to you.

  23. #23
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find & replace the data with Msgbox

    I can replicate your issue exactly by running EXACTLY the code that you ran, but i won't be able to until later on tonight. if you solve it by then, let us know.

  24. #24
    Forum Contributor
    Join Date
    05-10-2020
    Location
    india
    MS-Off Ver
    2013
    Posts
    221

    Re: Find & replace the data with Msgbox

    Np Take Ur Time Sir

  25. #25
    Forum Contributor
    Join Date
    05-10-2020
    Location
    india
    MS-Off Ver
    2013
    Posts
    221

    Re: Find & replace the data with Msgbox

    Thnx Alot Vba_php for helping me in solving this Problem
    Problem Solved
    Have a Awesome Day

  26. #26
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find & replace the data with Msgbox

    you too. glad to hear. =)

+ 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. Find duplicated value and print msgbox containing all data in one message.
    By behedwin in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-13-2017, 11:07 AM
  2. [SOLVED] Replace MsgBox with userform Yes & No
    By zplugger in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-04-2015, 04:10 PM
  3. If find and replace dialog box is in the narrow positon Then MsgBox
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-19-2014, 09:06 AM
  4. [SOLVED] Do Find & Replace multiple times using data in Col B for find & data in Col C for replace
    By ILoveStMartin in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-29-2012, 08:23 AM
  5. How do I replace the default msgbox for circular references?
    By ericsastud in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-19-2011, 10:21 AM
  6. [SOLVED] find and replace - replace data in rows to separated by commas
    By msdker in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-14-2006, 08:10 PM
  7. Replace method - cannot find any data to replace
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-06-2006, 04:00 PM

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