Automating Excel (Macros)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to create a macro that will move down a certain number of
cells (for example, 10 cells) and then enter a number? Thanks in advanced.
 
This will move down 10 rows and insert the row number ... as an example.

Sub test()
ActiveCell.Offset(10, 0).Select
ActiveCell.Value = ActiveCell.Row
End Sub

Regards

Trevor
 
Does this require VBA knowledge? If so, I don't know VBA. Where (what
screen) would I enter what you typed? I don't want this macro to insert a
row number - I want it to insert a number that I provide. Thanks.
 
Sub test2()
NumberToBeInput = InputBox("Enter a Number", "Input", 1)
ActiveCell.Offset(10, 0).Select
ActiveCell.Value = NumberToBeInput
End Sub

When in Excel, press Alt-F11 to open the Visual Basic Editor (VBE)

Select Insert | Module and then paste the code

Regards

Trevor
 
Excellent! It worked Trevor! Thanks!

Trevor Shuttleworth said:
Sub test2()
NumberToBeInput = InputBox("Enter a Number", "Input", 1)
ActiveCell.Offset(10, 0).Select
ActiveCell.Value = NumberToBeInput
End Sub

When in Excel, press Alt-F11 to open the Visual Basic Editor (VBE)

Select Insert | Module and then paste the code

Regards

Trevor
 
Back
Top