+ Reply to Thread
Results 1 to 14 of 14

How to enter vlookup in all sheets whose name ends with _AS in VBA

  1. #1
    Registered User
    Join Date
    03-06-2019
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    79

    Smile How to enter vlookup in all sheets whose name ends with _AS in VBA

    HI

    Guys my file has few sheets whose name ends with _AS. i want to insert a vlookup formula using vba on all the sheet where sheet name is Like *_AS.

    Thanks

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: How to enter vlookup in all sheets whose name ends with _AS in VBA

    What is the VLOOKUP formula you want to enter and which cell is it to go in on each sheet?

    BSB

  3. #3
    Registered User
    Join Date
    03-06-2019
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    79

    Re: How to enter vlookup in all sheets whose name ends with _AS in VBA

    cell should be A2
    VLOOKUP(X2,List!$B$2:$C$18,2,0)

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: How to enter vlookup in all sheets whose name ends with _AS in VBA

    Maybe this:
    Please Login or Register  to view this content.
    BSB

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: How to enter vlookup in all sheets whose name ends with _AS in VBA

    Just in case any sheet names have '_AS' anywhere else in the name than the last 3 characters you should use this line instead of the one in the previous post.
    Please Login or Register  to view this content.
    BSB

  6. #6
    Registered User
    Join Date
    03-06-2019
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    79

    Re: How to enter vlookup in all sheets whose name ends with _AS in VBA

    Its not going to sheets

    below one is going to sheets but it not ending and dont know how to add formulae

    Sub test()
    Dim ws As Worksheet, flg As Boolean
    Dim Formulae As String
    For Each ws In Sheets
    If ws.name Like "*WT" Then
    ws.Select Not flg
    ws.Cells(10, 41) = "Y"
    End If

    Next
    End Sub

  7. #7
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: How to enter vlookup in all sheets whose name ends with _AS in VBA

    Did you run the sub?

    Could you attach a desensitized version of the workbook?

    BSB

  8. #8
    Registered User
    Join Date
    03-06-2019
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    79

    Re: How to enter vlookup in all sheets whose name ends with _AS in VBA

    Code below is working but it not ending

    Sub BSB()
    Dim ws As Worksheet

    For Each ws In Sheets
    With ws
    'If InStr(1, .name, "_WT") Then .range("AO10").FormulaR1C1 = "=VLOOKUP(RC[23],List!R2C2:R18C3,2,0)"
    If Right(.name, 3) = "_WT" Then .range("Ao10").FormulaR1C1 = "Y"
    End With
    Next ws
    End Sub

  9. #9
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: How to enter vlookup in all sheets whose name ends with _AS in VBA

    What do you mean by "not ending"? It will loop through every sheet in the workbook and stop when it gets to the last one.

    BSB

  10. #10
    Registered User
    Join Date
    03-06-2019
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    79

    Re: How to enter vlookup in all sheets whose name ends with _AS in VBA

    It’s goes to end and then going back to first sheet

  11. #11
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: How to enter vlookup in all sheets whose name ends with _AS in VBA

    If you open the VB Editor, put the cursor somewhere in that macro and just press F5 once then let it go, does it run to the end and stop or start again?

    If the latter then attach the workbook and we can investigate better.

    BSB

  12. #12
    Registered User
    Join Date
    03-06-2019
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    79
    Hi

    Can you help me how to drag the formulae to end and paste the value instead of formulae


    Sub Test()
    Dim ws As Worksheet
    For Each ws In Sheets
    With ws
    If Right(.Name, 3) = "_WT" Then .Range("AO10").Formula = "=VLOOKUP((A10&G10),'Master BOM1'!$A:$V,14,0)"

    End With
    Next
    End Sub
    Last edited by A9kurs; 02-14-2020 at 11:37 AM.

  13. #13
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: How to enter vlookup in all sheets whose name ends with _AS in VBA

    To comply with forum rules you need to use code tags around your VBA. So you need to go back and edit your forum posts to do that before I will reply further.

    Whilst you're editing things, explain more what you mean by "drag the formula to the end"? End of what? End of time? End of my wits...?

    Example workbook will explain things far better.

    BSB

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

    Re: How to enter vlookup in all sheets whose name ends with _AS in VBA

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)

+ 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. Enter Once And Get it Sorted By Sheets
    By levpn in forum Excel General
    Replies: 1
    Last Post: 06-28-2017, 04:50 PM
  2. [SOLVED] If cell meets date requirement enter 1, if not enter 0, if blank don't enter anything.
    By billrogers184 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-11-2017, 02:04 PM
  3. [SOLVED] Setting a range that ends where data ends?
    By Mgassma in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-02-2013, 09:46 AM
  4. how to enter vaues at the same time in two sheets..
    By djmag in forum Excel General
    Replies: 10
    Last Post: 03-20-2013, 03:54 AM
  5. Enter same data across multiple sheets
    By wolverinej in forum Excel General
    Replies: 3
    Last Post: 02-12-2011, 01:51 AM
  6. Enter a number to the same cell for all sheets
    By minrufeng in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-22-2006, 02:35 PM
  7. Loop that deletes sheets if data ends on a certain row
    By Please Help in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-03-2005, 01:06 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