Friday, August 31, 2012

How to Select and Set Values to a Range in Excel with VBA

VBA Macro to Select and Set Values to a Range in Excel
Sub Mac()
Range("A1:A10").Select 'Select The Range'
End Sub

'Macro To Set A Value To A Range'
Sub Mac1()
Range("A1:A10") = 10 'Range Value Is Set To 10'
End Sub

'Macro To Set Values To Columns'
Sub Mac2()
Columns(c) = 15 'Column C Value is Set To 15'
Columns("D:E") = 20 'Column D,E Values are Set To  20'
End Sub

'Macro To Set  Values To Rows'
Sub Mac3()
Rows(5) = 25 'Row 5 Value Set To 25'
Rows("5:7") = 30 'Rows 5,7 Values are Set To 30'
End Sub

Thanks,Tamatam

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. If you wish, please share your genuine Feedback or comments only related to this Blog Posts. It is my humble request that, 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 Snapsh...

Popular Posts from this Blog