+ Reply to Thread
Results 1 to 5 of 5

Add your own cells you want to check in VBA code

  1. #1
    Registered User
    Join Date
    12-31-2012
    Location
    Poland
    MS-Off Ver
    2016
    Posts
    58

    Add your own cells you want to check in VBA code

    I have a file with a VBA code that gets data from source files and gets it all into a single master file. The VBA code fragment doing that is:

    Please Login or Register  to view this content.
    Can I set it up so that I can specify directly in the master file which cells in source files will be checked, i.e. let us take this row:
    Please Login or Register  to view this content.
    What code to use so that instead of C14, VBA will take data from a cell that I'll specify in E2 in my master file?

  2. #2
    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,628

    Re: Add your own cells you want to check in VBA code

    this C14 is just a string, so if in your master file in sheet identified as sh, cell E2 contains just
    C14
    then your line could read:
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Add your own cells you want to check in VBA code

    If you mean E2 will contain a string representing a cell address such as C14...
    Please Login or Register  to view this content.

  4. #4
    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: Add your own cells you want to check in VBA code

    What code to use so that instead of C14, VBA will take data from a cell that I'll specify in E2 in my master file?[/QUOTE]

    Hi,
    Try
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Assumes E2 contains an alphanumeric column row string, e.g. A100
    Last edited by Richard Buttrey; 08-17-2018 at 08:00 AM.
    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.

  5. #5
    Registered User
    Join Date
    12-31-2012
    Location
    Poland
    MS-Off Ver
    2016
    Posts
    58

    Re: Add your own cells you want to check in VBA code

    I didn't manage to get that to work, I've used the below code:

    Please Login or Register  to view this content.
    I tried to get master file to show in column F data from Sheet1's cells that I specified in master file's cell F2, e.g. F2 in the master file will show B5, and data from that cell in Sheet1 will be presented in the master. With the code above, nothing is shown, but when I clear F2, an error message pops up.

    Capture.JPG

+ 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: 10
    Last Post: 07-22-2018, 04:00 PM
  2. Code to fill cells with check box or data entry
    By Jr66 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-13-2016, 12:19 AM
  3. [SOLVED] VBA Code to Check if a Range of cells is Empty or Not and run code accordingly
    By unit285 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-01-2016, 08:19 PM
  4. How to check if excel file is Checked Out in SharePoing Check Out, run code, Check In
    By jrtraylor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-08-2016, 04:36 PM
  5. [SOLVED] VBA code to check if a range of cells have the same value
    By rshnkmr39 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-20-2015, 11:40 PM
  6. [SOLVED] VBA code for reference cells data check
    By JohnSavag in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-05-2012, 12:12 PM
  7. Code to check if cells contain value
    By JohnGaltnl in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-08-2012, 03:44 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