I’m attempting to extract values from a UserForm TextBox and an open workbook with <?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
<o></o>
<o></o>
Everything works except…<o></o>
The value returned to “QBI.xls” WS.Cells(iRow, 4) is from “Data.xls” Row5 instead of “Data.xls” last row.
I'm puzzled.<o></o>
<o></o>
Code:
[FONT=Verdana]ChDir "C:\MyCompany"<o:p></o:p>[/FONT]
[FONT=Verdana]Workbooks.Open Filename:="C:\MyCompany\QBI.xls"<o:p></o:p>[/FONT]
[FONT=Verdana]Set WS = Workbooks("QBI.xls").Worksheets("Sheet1")[/FONT]
[FONT=Verdana]iRow = WS.Cells(Rows.Count, 1) _<o:p></o:p>[/FONT]
[FONT=Verdana].End(xlUp).Offset(1, 0).Row[/FONT]
[FONT=Verdana]<o:p></o:p>[/FONT]
[FONT=Verdana]WS.Cells(iRow, 1).Value = Me.TextBox1.Value<o:p></o:p>[/FONT]
[FONT=Verdana]WS.Cells(iRow, 2).Value = "GrSales"<o:p></o:p>[/FONT]
[FONT=Verdana] WS.Cells(iRow, 3).Value = Me.TextBox33.Value<o:p></o:p>[/FONT]
[FONT=Verdana]‘Then…<o:p></o:p>[/FONT]
[FONT=Verdana] WS.Cells(iRow, 4).Value = Workbooks("Data.xls").Worksheets("Sheet1").Cells(iRow, 34).Value<o:p></o:p>[/FONT]
<o></o>
Everything works except…<o></o>
The value returned to “QBI.xls” WS.Cells(iRow, 4) is from “Data.xls” Row5 instead of “Data.xls” last row.
I'm puzzled.<o></o>