1 Write a subroutine to fill a block of cells with numbers. 2 Begin with a user
ID: 3673508 • Letter: 1
Question
1 Write a subroutine to fill a block of cells with numbers. 2 Begin with a user enter number and increment the number by an entered increment, like the series fill option. 3 Also enter the number of rows, cols and the beginning cell of the block. 4 If the numbers 10, 0.25, 2, 3, 4, 10 were entered, your subroutine would display 5 Use the block below to enter vour values. 10 10.25 10.5 10.75 1111.25 10 0.25 2 7 Beginning number Increment Number of rows 10 Number of columns Beginning row 12 Beginning column 4 10 13Explanation / Answer
Hi, following is the subroutine in excel vba
Sub FillBlockSubroutine()
dBegNum = InputBox("Enter Beginning number")
dInc = InputBox("Enter Increment")
dNumRows = InputBox("Enter Number of Rows")
dNumCols = InputBox("Enter Number Of Columns")
dBegRow = InputBox("Enter Beginning Row")
dBegCol = InputBox("Enter Beginning Column")
Worksheets("Sheet1").Activate
ActiveSheet.Cells(dBegRow, dBegCol).Select
Dim StartRow As Integer
Dim StartCol As Integer
For StartRow = 0 To dNumRows - 1
For StartCol = 0 To dNumCols - 1
ActiveCell.Offset(dBegRow + StartRow, dBegCol + StartCol).Select
ActiveCell.Value = dBegNum + dInc * (StartRow + StartCol)
Next StartCol
Next StartRow
End Sub
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.