Question

I would like to ask your help please.

I'm trying to build a form where user will have the option to paste data on the form spreadsheet, after I want to recover that data by VBA to insert it on table.

how can I use that Active X spreadsheet ?? how can I know what value are on cell A1 for example ????

please help me.

Was it helpful?

Solution 2

Set mySht = Me.Spreadsheet

With mySht With .ActiveWindow.ActiveSheet lastColumn = .UsedRange.Columns(mySht.ActiveWindow.ActiveSheet.UsedRange.Columns.Count).Column lastrow = .Range("A" & mySht.ActiveWindow.ActiveSheet.Rows.Count).End(xlUp).Row End With End With

MsgBox "Table dimention, Lines = " & lastrow & " columns = " & lastColumn

ReDim linea(lastColumn)

For i = 1 To lastrow For j = 1 To lastColumn

    mySht.Cells(i, j) 'something with the cell (i, j)
Next ' end line

Next ' next Line ' dispose Set mySht = Nothing

OTHER TIPS

You can refer to the object in a bound or unbound control:

Private Sub Command3_Click()
    Set obj = Me.OLEUnbound0.Object
    MsgBox obj.ActiveSheet.[a1]
End Sub

I think that it would be easier to just get the user to give you the name of the Excel sheet with the data. I suspect there will be quite a bit of training involved in this method.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top