Wednesday, July 20, 2022

How to auto insert values in Excel VBA with for loop by macro(event)

 Sub test()

Dim rng As Range, cell As Range

Set rng = Range("A1:A10")

For Each cell In rng

cell.Value = cell.Value * cell.Value

Next cell

End Sub

 or change Set rng = Range("A:A") 

for lakhs of values

 or

 change 

 Set rng = Selection

No comments:

Post a Comment