Re: Clean Up Code - consolidate steps
- From: "Bob Phillips" <phillips@xxxxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 22:31:11 +0100
There is no pattern to the values so the simplest thing is to simplify the
code
Range("A1").Value = "USB"
Range("A2").Value = "04165"
Range("A3").Value = "14709"
Range("A4").Value = "14716"
Range("A5").Value = "24704"
Range("A6").Value = "44705"
Range("A7").Value = "44710"
You could also load an array
aryValues = Array("USB", "04165", "14709", "14716", "24704", "44705",
"44710")
For i = 0 To UBound(aryValues)
Range("A" & i + 1).Value = aryValues(i)
Next i
--
HTH
Bob Phillips
"Frantic Excel-er" <FranticExceler@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:5F27D57A-DDF5-46F1-A9E4-CE2187D09679@xxxxxxxxxxxxxxxx
> Hi All...
>
> I have code that contains the following:
>
> ActiveCell.FormulaR1C1 = "USB"
> Range("A2").Select
> ActiveCell.FormulaR1C1 = "04165"
> Range("A3").Select
> ActiveCell.FormulaR1C1 = "14709"
> Range("A4").Select
> ActiveCell.FormulaR1C1 = "14716"
> Range("A5").Select
> ActiveCell.FormulaR1C1 = "24704"
> Range("A6").Select
> ActiveCell.FormulaR1C1 = "44705"
> Range("A7").Select
> ActiveCell.FormulaR1C1 = "44710"
>
> and it goes on to enter the associated text on the next line...all the way
> down to 60 rows. Is there a way that I can consolidate these steps where
the
> macro will automatically know to put the text in the next rows......for
> example....
> MACRO CODE = Enter Text, start A1...FAS,12354, 23456
>
>
>
>
>
.
- Follow-Ups:
- Re: Clean Up Code - consolidate steps
- From: Frantic Excel-er
- Re: Clean Up Code - consolidate steps
- From: Frantic Excel-er
- Re: Clean Up Code - consolidate steps
- References:
- Clean Up Code - consolidate steps
- From: Frantic Excel-er
- Clean Up Code - consolidate steps
- Prev by Date: Re: Clean Up Code - consolidate steps
- Next by Date: Re: Password Protecting
- Previous by thread: Re: Clean Up Code - consolidate steps
- Next by thread: Re: Clean Up Code - consolidate steps
- Index(es):
Relevant Pages
|