Issue with code pulling data from spreadsheet.

Cummins

Board Regular
Joined
Jul 26, 2011
Messages
58
Trying to pull data out of a spreadsheet and I am getting this error "Doesn't support this property or method" for line F1=ActiveWorkbook.ActiveSheet.
I've used something very similar to this before. Any idea what I am missing?

How can I define the array for F1? Is it needed?


Sub PullManualBatchData()

lastrow = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
'Dim F1 As Object
Dim Ary1(3, 1) As String

F1 = ActiveWorkbook.ActiveSheet
F1.Activate

'h = FreeFile

'Open File1 For Input As #h

g = 0

For x = 1 To lastrow
data = F1.Cells(x, 1)
If data <> "" Then Ary1(g, 1) = data And g = g + 1
Next
'Loop


'ThisWorkbook.Activate

Workbook_Open

End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,215,370
Messages
6,124,526
Members
449,169
Latest member
mm424

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top