ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple Question (for you wizards...) please help (https://www.excelbanter.com/excel-programming/334556-simple-question-you-wizards-please-help.html)

Alex[_26_]

Simple Question (for you wizards...) please help
 
Hello,
with this simple code I cycle on the "A" column (a1,a2,a3 etc.)and I
see if its contents is <= or 10.

-------------
Sub macro()
For i = 1 To 65536
SelezioneCella = Range("a" & i)
Range("b" & i).Select
Select Case SelezioneCella

Case Is <= 10
ActiveCell.FormulaR1C1 = "minore o uguale a 10"
Case Is 10
ActiveCell.FormulaR1C1 = "maggiore di 10"
Case Else
ActiveCell.FormulaR1C1 = "non era un numero"
End Select

Next i
-------------

Now my problem is that I'd like to cycle on the first row, I mean
(a1,b1,c1 etc.).
How can I do that?.

Thanks.
Alex.


Otto Moehrbach

Simple Question (for you wizards...) please help
 
Your Range("a" & i) cycles through the A column. To cycle through the first
row use:
Cells(1, i). The "i" is then the column number and the "1" is the row
number. HTH Otto

"Alex" wrote in message
oups.com...
Hello,
with this simple code I cycle on the "A" column (a1,a2,a3 etc.)and I
see if its contents is <= or 10.

-------------
Sub macro()
For i = 1 To 65536
SelezioneCella = Range("a" & i)
Range("b" & i).Select
Select Case SelezioneCella

Case Is <= 10
ActiveCell.FormulaR1C1 = "minore o uguale a 10"
Case Is 10
ActiveCell.FormulaR1C1 = "maggiore di 10"
Case Else
ActiveCell.FormulaR1C1 = "non era un numero"
End Select

Next i
-------------

Now my problem is that I'd like to cycle on the first row, I mean
(a1,b1,c1 etc.).
How can I do that?.

Thanks.
Alex.




Alex[_26_]

Simple Question (for you wizards...) please help
 
Thank you!!!.



All times are GMT +1. The time now is 06:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com