svendiamond
Well-known Member
- Joined
- Jun 13, 2014
- Messages
- 1,504
- Office Version
- 365
- Platform
- Windows
Hello all! I received advice from one of the pros on here, can't remember whether it was Aladdin or Rick, but it was regarding looping through an array stored in VBA rather than writing to a sheet during a loop. This has made things much faster. However I can't seem to store a text variable in my array.
For example this code:
The code works great except if the value is a number stored as text such as "000123456789" then the new data transfers over as a number value without the zeroes in front. I've tried "Format(myData(i, 1), "@")" but that doesn't work. Any ideas?
For example this code:
Code:
With .Range("A2:H" & lastRow)
myData = .Value
For i = 1 To UBound(myData)
newData(n, 1) = myData(i, 1)
Next i
.Cells = newData
End With
The code works great except if the value is a number stored as text such as "000123456789" then the new data transfers over as a number value without the zeroes in front. I've tried "Format(myData(i, 1), "@")" but that doesn't work. Any ideas?