+ Reply to Thread
Results 1 to 1 of 1

How to incorporate a condition using VBA code in an existing macro within the workbook

  1. #1
    Registered User
    Join Date
    04-22-2015
    Location
    Hampshire, UK
    MS-Off Ver
    2007
    Posts
    1

    Question How to incorporate a condition using VBA code in an existing macro within the workbook

    I am trying to write a short macro which can Unprotect/Refresh Data Link/Protect my workbook. I found some very helpful code on Excel Forum and now have a macro which does exactly what I want. The macro operates via a button on the worksheet. However, I now feel it may be necessary to add a "condition". After clicking on the macro button, the workbook is unprotected, the directory path of the file needed to refresh data will show on screen, the user selects (clicks) the file, the data refreshes, the workbook is then protected again. If the user should decide to click on cancel instead of selecting the file, at this point the debug windows appears. Is there a simple short code or msg box that could appear on screen if the user selects cancel, along the lines of "you did not select a file and the data has not been refreshed".

    I am completely new to VBA code and apologise if I am unclear in any way. The code I have is as follows:
    Please Login or Register  to view this content.
    Thank you for any guidance you can give me on this.
    Last edited by Leith Ross; 04-22-2015 at 12:42 PM. Reason: ASdded Code Tags

+ 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. Incorporate array into existing code
    By DavidRoger in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-10-2014, 09:12 PM
  2. Excel VBA Incorporate "row autofit + 20" into existing code
    By garoe in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-27-2014, 06:00 AM
  3. Have existing formatting code. Need to add macro to new workbook.
    By PeteABC123 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-07-2014, 11:36 AM
  4. Replies: 0
    Last Post: 01-19-2014, 04:01 PM
  5. Replies: 2
    Last Post: 12-17-2013, 11:51 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