Fill each time one cell/row with a specific number,for defined col

G

Guest

Hello,
I've a problem of designing all possibilities of below criteria on the same
range.
*Fill each time one cell/row
*Each row has a specific number to be filled for its cells
*The numbers of columns are defined.

For ex., for 3 rows and 4 columns, and for specific numbers of each rows,
the number of arrangements on a defined range is = 4^3=64. How will i see all
possibilities sequently replaced to the range? Thanks for help.
 
G

Guest

you can use a wroksheet change function like below. code will copy any data
in a range to sheet 2 placing each change is the first open cell in column A.

Sub worksheet_change(ByVal Target As Range)

Const StartRow = 1
Const EndRow = 4
Const StartCol = 3
Const EndCol = 6


For Each cell In Target
If (cell.Row >= StartRow) And (cell.Row <= EndRow) And _
(cell.Column >= StartCol) And (cell.Column <= EndCol) Then

'copy data to sheet 2
With Sheets("sheet2")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
.Cells(LastRow + 1, "A").Value = cell.Value
End With

End If

Next cell

End Sub


sub work
 

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