Where can I insert loop?

drmingle

Board Regular
Joined
Oct 5, 2009
Messages
229
I have three sheets:

  • Zipcode_Funnel (list of select zip codes)
  • Zipper (demographic output)
  • Master (reformatted output)
I want to be able to loop through my program until the cell on sheets "Zipcode_Funnel" range ("A2") is empty.

Code:
Sub Zipper()
'
'Description: pull relevant demographic data on select zipcodes

'Pull zipcode from "Zipcode_Funnel" page and places it on "Zipper" page
Call Zipcode_Feed
'Back to "Zipper" page as defualt
Call Go_Back

'Pull data from demographic site and place on "Zipper" page
    Rows("4:198").Select
    Selection.ClearContents
    Selection.QueryTable.Delete
    Range("A2").Select
    
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://zipskinny.com/index.php?zip=" & Range("A2"), Destination:=Range("A4"))
        .Name = "index.php?zip=" & Range("A2")
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "6,7,9,11,14,15"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With

'Automated reformating routine
Call Insert_New_Line
Call Economic_Indicators
Call Go_Back
Call Female_Per_Of_All
Call Go_Back
Call Female_Per_Of_Females
Call Go_Back
Call General_Information
Call Go_Back
Call Male_Female_Median_Age
Call Go_Back
Call Male_Female_Per_Of_All
Call Go_Back
Call Male_Per_Of_All
Call Go_Back
Call Male_Per_of_Males
Call Go_Back
Call Marital_Status
Call Go_Back
Call Median_Household_Income
Call Go_Back
Call Occupation
Call Go_Back
Call Race
Call Go_Back
Call Social_Indicators
Call Go_Back
Call Zipcode

'***Looking for help here; would like to loop through column ("A") on "Zipper_Funnel"Sheet until cell ("A2") is empty***
      ' Select cell A2, *first line of data*.
    Sheets("Zipcode_Funnel").Select
    Range("A2").Select
      ' Set Do loop to stop when an empty cell is reached.
    Do Until IsEmpty(ActiveCell)
       ' Step down 1 row from present location.
    ActiveCell.Offset(1, 0).Select
    Loop
End Sub
Any help would be appreciated...
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,216,099
Messages
6,128,819
Members
449,469
Latest member
Kingwi11y

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top