[RESOLVED] For each record loop? - VBA
Disclaimer - Newer to VBA.
I have a sheet I want to print out, for each record in a range.
In the range, I have the following data:
Apple
Grape
Pear
Apricot
The price breaks are based on information in columns 2 - 4 of the range.
I have a seperate window, which is all formated pretty like. What I want to do is enter Apple in the top cell (programatically) and print the page, then change Apple to Grape, and print the page again.
I am trying to do something like a For each, Do Loop....but am not having any luck....any ideas ?
Re: For each record loop? - VBA
This is Excel? When you say a "separate window", do you mean that you have 2 Excel workbooks open and you want to take the fruity data from a sheet in one workbook and programmatically use that to operate on a sheet in the second workbook?
Re: For each record loop? - VBA
Try the following
VB Code:
Sub loop_example()
Dim MyRange As Range
Dim MyCell As Range
Set MyRange = 'Insert your range here
For Each MyCell In MyRange.Columns(1).Cells
MsgBox MyCell.Value
Next MyCell
End Sub
Re: For each record loop? - VBA
DKenny!
You Rock! Works Great!
Sorry, webtest...I should have been clearer...different worksheet...only one instance of Excel is running....
The printer is going wild !!
Re: [RESOLVED] For each record loop? - VBA
"The printer is going wild !!"
Post your code.
Re: [RESOLVED] For each record loop? - VBA
That is a good thing.
I have a hundred or so items, and it is changing the item and printing the page, changing the item and printing the page.....
all I have to do is press one button!
This is great!