ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Fill each time one cell/row with a specific number,for defined col (https://www.excelbanter.com/excel-programming/398656-fill-each-time-one-cell-row-specific-number-defined-col.html)

nerohnze

Fill each time one cell/row with a specific number,for defined col
 
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.

joel

Fill each time one cell/row with a specific number,for defined col
 
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

"nerohnze" wrote:

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.



All times are GMT +1. The time now is 04:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com