Results 1 to 14 of 14

VBA Loops / IF

Threaded View

  1. #1
    Registered User
    Join Date
    05-21-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    25

    VBA Loops / IF

    VBA Loops / IF



    This is likely to be really simple for many, but I can't seem to get my head around it. I have the below which works almost perfectly.

    I basically have a list of 50 invoices in the A column and a invoice template on another sheet. The invoice template will pull the information for A2 so all the information is in the invoice, then save. As the information is pulled only from A2, I need to then delete that row so it picks up the next item in the list.

    Currently, because im deleted a row it is skipping numbers, for example, if I had a list of 1-10 it would save, 1,3,5,7,9 and complete.

    Any help or edits would be appreciated


    Sub test()
     For each x in range (“A2:A50”)
    If x.value = “>1” then
     Sheets("Template Re-design").Select
     FileName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 5)
     ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
     "M:\2016\Collections AR\RESTORED\Invoices\" & Cells(1, 1).Value & ".pdf", _
     Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
     :=False, OpenAfterPublish:=False
     Sheets("Addresses").Select
     Rows("2:2").Select
     Selection.Delete Shift:=xlUp
     End if
     Next x
     End Sub
    Last edited by ddbroadhead92; 07-28-2016 at 10:06 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA loops
    By Malowle in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-13-2012, 05:30 PM
  2. VBA Loops
    By jeskit in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2011, 06:58 AM
  3. VBA Loops
    By jeskit in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2011, 09:19 AM
  4. VBA Loops
    By jeskit in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-24-2011, 10:26 AM
  5. Help with Loops
    By manojparmar in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-21-2006, 05:28 AM
  6. [SOLVED] Loops & Ifs
    By Shorty in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-04-2006, 07:10 AM
  7. [SOLVED] Loops
    By David in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2006, 07: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