ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reading data from a user form into a sheet (https://www.excelbanter.com/excel-programming/340320-reading-data-user-form-into-sheet.html)

[email protected]

Reading data from a user form into a sheet
 
I'm trying to transfer values from a user form into a sheet. User form
data are stored in the vector DataArray and are transfered into the
sheet by:

Cells(NewRow, 1) = NewRow - 1
For i = 0 to 222
Cells(NewRow, i + 2) = DataArray(i)
Next i

It works fine exept that numbers will be formated as text (?) when
being read into the sheet and aligned to the left in the cell. By
double-clicking that cell, the figure will be aligned right and
formated as number. Any suggestions how to get round this?

/Fred

David Hepner

Reading data from a user form into a sheet
 
Try this:

Cells(NewRow, 1) = NewRow - 1
For i = 0 To 222
Cells(NewRow, i + 2) = Val(DataArray(i))
Next i

" wrote:

I'm trying to transfer values from a user form into a sheet. User form
data are stored in the vector DataArray and are transfered into the
sheet by:

Cells(NewRow, 1) = NewRow - 1
For i = 0 to 222
Cells(NewRow, i + 2) = DataArray(i)
Next i

It works fine exept that numbers will be formated as text (?) when
being read into the sheet and aligned to the left in the cell. By
double-clicking that cell, the figure will be aligned right and
formated as number. Any suggestions how to get round this?

/Fred



All times are GMT +1. The time now is 10:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com