문제

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.

도움이 되었습니까?

해결책 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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top