REPEAT NTH ROWS

J

Junior728

Hi,

I wish to prompt the user for 2 parameters(M, N) inputs for every 26th row.
This is what i have in my macro but somehow it does not work. Is there any
problem with my coding?

E.g.

Sub Testing( )

M$ = InputBox("RMANO") 'Prompt user for Input
N$ = InputBox("ACCT") 'Prompt user for Input

Dim LstRow As Integer
Dim NwRow As Integer
Dim NthRow As Integer

'To Repeat This every 26 lines from currentrow
NthRow = 25
LstRow = Cells.SpecialCells(xlLastCell).Row

Do Until ActiveCell.Row > LstRow
ActiveCell = Cells(3, 14).Select
ActiveCell.Offset(NwRow, 0).Select
M$ = Cells(3, 14).value 'First parameter in Column M,
N$ = Cells(3, 11).value Second parameter in Column N
NwRow = NwRow + 1
ActiveCell.Offset(NthRow - 1, 0).Select
Loop

End Sub
 
J

JLGWhiz

I wish to prompt the user for 2 parameters(M, N) inputs for every 26th row.
This is what i have in my macro but somehow it does not work. Is there any
problem with my coding?

E.g.

Sub Testing( )

M$ = InputBox("RMANO") 'Prompt user for Input
N$ = InputBox("ACCT") 'Prompt user for Input

Dim LstRow As Integer
Dim NwRow As Integer
Dim NthRow As Integer

'To Repeat This every 26 lines from currentrow
NthRow = 25
LstRow = Cells.SpecialCells(xlLastCell).Row

Do Until ActiveCell.Row > LstRow
Cells(3, 14).Select
ActiveCell.Offset(NwRow, 0).Select
'If you want cell(3, 14) Or Range("N3") to equal the
'M$ value from the InputBox function then:

Cells(3, 14) = M$
'Same for N$:
Cells(3, 11) = N$ 'Only this puts it in Range("K3")
'Cells(3, 13) woud be Range("M3")

M$ = Cells(3, 14).value 'First parameter in Column M,
N$ = Cells(3, 11).value Second parameter in Column N

'Don't know what the NwRow means. There is no starting value.
NwRow = NwRow + 1

ActiveCell.Offset(NthRow - 1, 0).Select
Loop

End Sub


If you can think this over and repost with a more consitent
description of what you need, I'm sure we can fix you up. This
description and the sample code are a little confusing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top