Tim Hanson
Member
The code checks to see if the cells in column F is numeric if so then copies the value to the adjacent cell in column G and clears the original cell
I have been reading on how to write two dim arrays, the code works but I cannot tell if I am fully utilizing the two dimensional benefits
I am hoping someone might give me insights where or if I have gone wrong? or if it is not exactly wrong how might it be improved
Thank you
I have been reading on how to write two dim arrays, the code works but I cannot tell if I am fully utilizing the two dimensional benefits
I am hoping someone might give me insights where or if I have gone wrong? or if it is not exactly wrong how might it be improved
Thank you
Code:
'Using a 2 dim array
Sub MoveNumbers3()
Dim ws As Worksheet
Dim myArray As Variant
Dim lastrow As Long
Dim x As Integer
Dim Y As Integer
Set ws = ThisWorkbook.Sheets("XXX")
With ws
lastrow = .Range("F" & .Rows.Count).End(xlUp).Row
myArray = .Range("F2:F" & lastrow).Value
myArray = .Range("F2:F" & lastrow).Value
End With
For x = LBound(myArray) To UBound(myArray)
For Y = LBound(myArray, 2) To UBound(myArray, 2)
If IsNumeric(myArray(x, Y)) Then
Cells(x, Y).Offset(1, 6).Value = myArray(x, Y)
Cells(x, Y).Offset(1, 5).Value = " "
End If
Next Y
Next x
End Sub
Last edited: