+ Reply to Thread
Results 1 to 7 of 7

vba macros

  1. #1
    Forum Contributor
    Join Date
    08-18-2017
    Location
    SOUTH AFRICA
    MS-Off Ver
    MS EXCEL 2016
    Posts
    132

    vba macros

    Good day

    Can you please assist with the vba code for the attached excel sheet.

    If cell: AP3 = 2, to copy cell: AF11 and paste to cell: D2
    also if cell: AP3 = 3, to copy cell AF12 and paste to cell: D2

    I hope this makes sense

    Regards;
    Attached Files Attached Files

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,104

    Re: vba macros

    Can you please change the title to something that more accurately describes your problem, because otherwise it's hard for us to navigate through a bunch of generic titles?

    About your issue, you don't need vba for this.

    You can simply use in D2: =VLOOKUP(AP3,$AE$11:$AF$20,2,FALSE)
    Never use Merged Cells in Excel

  3. #3
    Forum Contributor
    Join Date
    08-18-2017
    Location
    SOUTH AFRICA
    MS-Off Ver
    MS EXCEL 2016
    Posts
    132

    Re: vba macros

    The reason why I cant use a formula on D2 is because if cell: AP3 = 1, then D2 will be a manual entry

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,104

    Re: vba macros

    Here, use this within some other code:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    03-05-2025
    Location
    Deutschland
    MS-Off Ver
    MS Office Home & Business 2024
    Posts
    408

    Re: vba macros

    Hi,

    this in the Modul of your Worksheet:

    Please Login or Register  to view this content.
    BR, Alexandra

  6. #6
    Forum Contributor
    Join Date
    08-18-2017
    Location
    SOUTH AFRICA
    MS-Off Ver
    MS EXCEL 2016
    Posts
    132

    Re: vba macros

    Thanks a lot it work perfectly

  7. #7
    Forum Contributor
    Join Date
    03-05-2025
    Location
    Deutschland
    MS-Off Ver
    MS Office Home & Business 2024
    Posts
    408

    Re: vba macros

    You´re welcome!

+ 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. [SOLVED] Sort Operation Works when Macros are called manually, but not when VBA calls the Macros
    By lovecolorado in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-18-2019, 02:13 PM
  2. Multiple macros for several files that change weekly - where to store macros
    By janljan in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-21-2018, 10:54 PM
  3. Cant hide worksheets after macros to force users to enable macros
    By Mboemoyo85 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2015, 02:52 AM
  4. Replies: 0
    Last Post: 06-09-2015, 09:30 PM
  5. Replies: 5
    Last Post: 07-26-2012, 09:38 PM
  6. Macros: Data cleaning macros not producing expected outputes.
    By bertlogdi1 in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 06-17-2011, 06:52 AM
  7. [SOLVED] choose default macros Not Enabled / Macros Enable Setting
    By BEEJAY in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2006, 08:10 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