Kamis, Mei 07, 2015

Fill Excel Cell With Text, Number or Character Using Macro

Example we want to fill A1 cell with a text:
Menu Developer > Visual Basic > Right click on VBEProject(file_name.xlsx) > Insert > Module, type code follows:
Sub fillData()
  Range("A1").Value = "text will display as cell content"
End Sub

If want to fill text from A1 cell to F6:
Sub fillData()
  Range("A1:F6").Value = "text will display as cell content"
End Sub

If want to be filled by number:
Sub fillData()
  Range("A1:F6").Value = 789
End Sub

Sumber: Tutorial Excel Indonesia: https://www.youtube.com/watch?v=RxAgtqr6YA4

0 komentar: