Jump to content

Microsoft Excel Question


Recommended Posts

Posted

Can you help me with this. I need to repeat rows like this:

 

1

1

1

1

2

2

2

2

3

3

3

3

4

4

4

4

.... up to 200

 

Is there a way to do it? I tried to point cursor in the corner and drag it but it's only repeating those 1,2,3 and 4. I need sets like this up to 200. 

Posted

Click developer, open visual basic and put this code

Hit run

__________

Code:

__________

Sub numbers()
 
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("A2").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("A4").Select
    ActiveCell.FormulaR1C1 = "1"
    For i = 1 To 796
    Selection.Offset(1, 0).Select
    ActiveCell = "=R[-4]C+1"
    Next i
 
End Sub
 
  • Upvote 1
Posted

 

 

Click developer, open visual basic and put this code

Hit run

__________

Code:

__________

Sub numbers()
 
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("A2").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("A4").Select
    ActiveCell.FormulaR1C1 = "1"
    For i = 1 To 796
    Selection.Offset(1, 0).Select
    ActiveCell = "=R[-4]C+1"
    Next i
 
End Sub

 

YOU ARE AMAZING. THANKS!!!   ()>>

Posted

 

Click developer, open visual basic and put this code

Hit run

__________

Code:

__________

Sub numbers()
 
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("A2").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("A4").Select
    ActiveCell.FormulaR1C1 = "1"
    For i = 1 To 796
    Selection.Offset(1, 0).Select
    ActiveCell = "=R[-4]C+1"
    Next i
 
End Sub

 

good one thax Bro

Posted

 

Click developer, open visual basic and put this code

Hit run

__________

Code:

__________

Sub numbers()
 
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("A2").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("A4").Select
    ActiveCell.FormulaR1C1 = "1"
    For i = 1 To 796
    Selection.Offset(1, 0).Select
    ActiveCell = "=R[-4]C+1"
    Next i
 
End Sub

 

 

Ila raasthunna pani chesthundhi man....

 

Sub numbers()
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "1"
    For i = 1 To 799
    Selection.Offset(1, 0).Select
    ActiveCell = "=R[-4]C+1"
    Next i

End Sub

 

I was just playing with your code.

×
×
  • Create New...