Hello! I am hoping for some more help. I want to select a square of x*x where x is variable(FIN as I did here) and calculated in 2 first lines in the code below. Selecting x values in single column isn`t a problem, but I would like to select whole square(X*X starting at B2). I have a value calculated in another cell(coded as countif). Total selected cells should be the power of that value. If 5, total cells selected should be 25 etc(matrix). It must be accurate, because the next step will be to use the =mmult function(creating matrix), which I have ready to use from the selection:
Really appreciate any help. The function works properly except selecting the whole square(it only selects "x" value down in the column).Sub selection()
Workbooks("Database.xlsm").Worksheets("Sheet1").Activate
Range("B1").Select
ActiveCell.FormulaR1C1 = "=(COUNTIF(R[1]C[-1]:R[1048575]C[-1],""*""))"
Dim FIN As Long
Workbooks("Database.xlsm").Worksheets("Matrix").Activate
Worksheets("Matrix").Activate
FIN = Worksheets("Sheet1").Cells("1", "B").Value
Dim StartCellLtR As String
Dim StartCellNuM As Integer
Dim EndCellLtR As String
Dim EndCellNuM As Integer
Dim TheRangE As String
Dim perfect As String
StartCellLtR = "B"
StartCellNuM = 2
EndCellLtR = "B"
EndCellNuM = FIN + 1
TheRangE = StartCellLtR & Trim(StartCellNuM) & ":" & EndCellLtR & Trim(EndCellNuM)
Range(TheRangE).Select
End Sub
Bookmarks