Macro ask for user input and paste it into every nth row

Fiveshorter

New Member
Joined
Jul 14, 2017
Messages
18
Hi,

I have two columns of data :
A23
A33
B12

B44

<tbody>
</tbody>

What I would like to be able to do is ask the user how many in column 1, cells are the same (what is the trend) in this case it would be two as we have Two As, Two Bs. Then I would like to be able to prompt the user for two inputs ( as we entered two before this as this is the trend ), input the letter 'D' and the number "33.33". So the data will now look like this :
A23D
A3333.33
B12D
B4433.33

<tbody>
</tbody>


Another example if I had the following table :
A22
A34
A4
B23
B2
B13

<tbody>
</tbody>


The trend is 3 as we have 3 a's and 3 b's. Then we enter 3 pieces of information, input 1 =2.22, input 2 = 444.55, input 3 = 33.99999 and our table would look like this :
A222.22
A34444.55
A433.99999
B232.22
B2444.55
B1333.99999

<tbody>
</tbody>

If anyone could help to build a macro for this it would be greatly appreciated, hopefully I explained well enough!

Thanks!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
assuming you data starts in row 1,

Code:
Sub Do_it()
wr = -1

lr = Cells(Rows.Count, "A").End(xlUp).Row

x = Int(InputBox("What is the trend"))
If Not x > 0 Then Exit Sub
For t = 1 To x
     Data = InputBox("What is the data point #" & t)
For r = 1 To lr Step x
     Cells(wr + r + t, "B") = Data
Next r
Next t
End Sub

hth,

Ross
 
Upvote 0

Forum statistics

Threads
1,215,474
Messages
6,125,024
Members
449,204
Latest member
LKN2GO

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top