Wednesday, September 26, 2012

How to Auto Fill Default, Auto Fill Series in Excel using VBA

Excel VBA Macro to Auto Fill Default, Auto Fill Series
MODEL 1:
'Macro To AutoFillDefault :
'This Is A User Friendly Macro which Works Based on User Selection
Sub FillDefault()
For X = 1 To 100
Selection.AutoFill Range(ActiveCell.Offset(X, 0), ActiveCell.Offset(0, 0)), xlFillDefault
Next X
End Sub

'Macro To AutoFillSeries :
'This Is A User Friendly Macro which Works Based on User Selection
Sub FillSeries()
For X = 1 To 100
Selection.AutoFill Range(ActiveCell.Offset(X, 0), ActiveCell.Offset(0, 0)), xlFillSeries
Next X
End Sub
-----------------------------------------------------------------------
MODEL 2:
Macro To AutoFillSeries :
Sub AutoFillSeries()
'If You Know Active Cell Then You Can AutoFillSeries As
'Syntax 1:
Cells(2, 1).AutoFill Range("A2:A100"), xlFillSeries
'Syntax 2:
Cells(2, 1).AutoFill Destination:=Range("A2:A100"), Type:=xlFillSeries
End Sub

Macro To AutoFillDefault :
Sub AutoFillDefault()
'If You Know Active Cell Then You Can AutoFillDefault As
'Syntax 1:
Cells(2, 1).AutoFill Range("A2:A100"), xlFillDefault
'Syntax 2:
Cells(2, 1).AutoFill Destination:=Range("A2:A100"), Type:=xlFillDefault
End Sub

Thanks,Tamatam

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.

Featured Post from this Blog

How to compare Current Snapshot Data with Previous Snapshot in Power BI

How to Dynamically compare two Snapshots Data in Power BI Scenario: Suppose, we have a sample Sales data, which is stored with Monthly Snaps...

Popular Posts from this Blog