Charlreena
New Member
- Joined
- Jul 17, 2018
- Messages
- 3
I have a basic array function that copies various cells and pastes them into a database in the correct order. I'm adding in some additional columns & some of the cells I need the array to copy are made up of numbers & text. I only need the array to copy and paste the number and not the text. Is there a way to do this? I understand the easiest way would be to split out the text and numbers originally, but it's a document that's converted into excel & that's how it converts unfortunately.
This is my code.
Thanks
This is my code.
Code:
Dim lr As Long, i As Long, cls
cls = Array("A2", "F3", "F4", "F5", "C2", "G2", "L2", "U2", "U3", "W2", "W3", "O2", "O3", "S2", "S3")
With Sheets("example")
lr = WorksheetFunction.Max(3, .Range("C" & Rows.Count).End(xlUp).Row + 1)
For i = LBound(cls) To UBound(cls)
.Cells(lr, i + 3).Value = Sheets("example").Range(cls(i)).Value
If .Cells(lr, i + 3) < 0 Then .Cells(lr, i + 3) = .Cells(lr, i + 3) * -1
If .Cells(lr, i + 3) = "" Then .Cells(lr, i + 3) = 0
Next i
End With
Thanks