help with efficiency

MichaelRose94

New Member
Joined
Feb 15, 2018
Messages
5
Hi I am trying to place in column A, a list of numbers from 1, 2, 3, 4, etc.

At the moment, I am using the following VBA code. Could any one recommend a more efficient way? Thanks in advance


Range("A1").Select
ActiveCell.FormulaR1C1 = "1"
Range("A2").Select
ActiveCell.FormulaR1C1 = "2"
Range("A1:A2").Select
Selection.AutoFill Destination:=Range("A1:A1440")
Range("A1:A1440").Select
Range("D1").Select
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Also for the following, what would be a more efficient way of getting the same results? Like and smiles will be coming your way!

Sub ABCDE()
'
' ABCDE Macro
'
'
Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A1").Select
ActiveCell.FormulaR1C1 = "Record"
Range("B1").Select
ActiveCell.FormulaR1C1 = "DATE"
ActiveWindow.LargeScroll Down:=1
Range("B30").Select
ActiveWindow.SmallScroll Down:=-511
Range("C1").Select
ActiveCell.FormulaR1C1 = "TIME"
Range("D1").Select
ActiveCell.FormulaR1C1 = "FLOW_PV"
Range("E1").Select
ActiveCell.FormulaR1C1 = "FLOW_TOTAL"
Range("D2").Select
End Sub
 
Upvote 0
for your first question:

Code:
For i = 1 To 1440
    Cells(i, 1) = i
Next

Second:

Code:
Rows(1).Insert 
 
Cells(1).Resize(, 5) = Array("Record", "DATE", "TIME", "FLOW_PV", "FLOW_TOTAL")
 
Last edited:
Upvote 0
For the 1st one
Code:
Range("A1").Value = 1
Range("A1").AutoFill Range("A1:A1440"), xlFillSeries
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top