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

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
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,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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