shayanhaque
New Member
- Joined
- Mar 13, 2019
- Messages
- 19
Below is my code:
I'm trying to store data into an array, once its done trying to open new sheet and paste array data into new sheet's column A. It opens new sheet but doesn't unload data into new sheet. Please assist.
Sub LoadArray()
Dim TotalRows As Long
Dim x As Integer
Dim i As Integer
Dim zArray As Variant
Dim ws As Worksheet
Dim rng As Range
Dim strArray As Variant
TotalRows = Rows(Rows.Count).End(xlUp).Row
x = WorksheetFunction.CountA(Worksheets(1).Columns(1))
ReDim strArray(x)
For i = 1 To x
strArray(i) = Cells(i, 1).Value
Range("v1").Offset(i - 1, 0).Value = strArray(i)
Next i
Set newbook = Workbooks.Add
With newbook
ActiveSheet.Range("a1").Value = Application.WorksheetFunction.Transpose(strArray)
MsgBox "Loaded " & UBound(strArray) & " items!"
End Sub
I'm trying to store data into an array, once its done trying to open new sheet and paste array data into new sheet's column A. It opens new sheet but doesn't unload data into new sheet. Please assist.
Sub LoadArray()
Dim TotalRows As Long
Dim x As Integer
Dim i As Integer
Dim zArray As Variant
Dim ws As Worksheet
Dim rng As Range
Dim strArray As Variant
TotalRows = Rows(Rows.Count).End(xlUp).Row
x = WorksheetFunction.CountA(Worksheets(1).Columns(1))
ReDim strArray(x)
For i = 1 To x
strArray(i) = Cells(i, 1).Value
Range("v1").Offset(i - 1, 0).Value = strArray(i)
Next i
Set newbook = Workbooks.Add
With newbook
ActiveSheet.Range("a1").Value = Application.WorksheetFunction.Transpose(strArray)
MsgBox "Loaded " & UBound(strArray) & " items!"
End Sub