Thread: Loop Macro??
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default Loop Macro??

Try this

Sub Test()
Dim myCell As Range
Dim myRangeName As String '<~~I've used a range name, but I think it would
work without
Dim aWS As Worksheet
Dim myValList As Range
Dim myValidation As Range
Set aWS = ActiveSheet

Set myCell = aWS.Range("I3") '<~~replace cell address
myRangeName = Replace(myCell.Validation.Formula1, "=", "")
Set myValList = Range(myRangeName)


For Each myValidation In myValList

myCell.Value = myValidation.Value

Next myValidation

End Sub
--
HTH,
Barb Reinhardt



"Steve" wrote:

I think I need to create a loop Macro to do this, but i'm not sure...

Here's the situation:

I have a cell (D8) that contains a drop down box of about 20 unique codes.
When the code is selected it auto-formulates all the necessary information on
the next sheet over (Check Request Sheet).

What I need to be able to do is have a Macro that when I run it, it
automatically goes through and selects each code from the drop down box and
then prints what is on the Check Request Sheet and then goes to the next code
and does the same.

I already have all the formulas and such written to auto-format the Check
Request Sheet. I just need to know how to create a macro that would allow
for the selecting and printing repeating cycle. I was thinking maybe a loop
macro, but I'm not really sure, I'm still trying to read about them to better
understand what they do.

Thanks,

Steve