View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Eduardo Eduardo is offline
external usenet poster
 
Posts: 2,276
Default Userform multiple colums and rows

Hi,
You cannot add another comment in column 4 you will need another column with
the statement as follow

ws.Cells(iRow, 5).Value = Me.Othercomment.Value

"Gaylen" wrote:

Hi my second part of the statement look as follows
ws.Cells(iRow, 1).Value = Me.txtIDkey.Value
ws.Cells(iRow, 2).Value = Me.txtDate.Value
ws.Cells(iRow, 3).Value = Me.cboRegnr.Value
ws.Cells(iRow, 4).Value = Me.txtComment.Value

What i want to do and having problem is, to add a next comment also in
column 4 but a new row. this is the formula i want to add, but statement
cause the previous one to be overwritten. I've also discover that the key is
in the <iRow definition.

ws.Cells(iRow, 4).Value = Me.txtComment2.Value

Which brings me back to this statement

iRow = Worksheets(€śsheet1€ť).Cells(Rows.Count, 1) _ .End(xlUp).Offset(1,
0).Row

"Eduardo" wrote:

Hi,
that is not all your code for sure you have something like this
.Cells(iRow, 4).Value = Me.TxtProjectname.Value

Check that for the second comment you are pointing to a different column, in
my case column D (4)

"Gaylen" wrote:

Hi, Im new to VBA programming, Ive learned a bit from Debra web page to
create a user form and am using the following statement to find first empty
row in database.
iRow = Worksheets(€śsheet1€ť).Cells(Rows.Count, 1) _ .End(xlUp).Offset(1,
0).Row
It works fine when writing one row and 4 columns. Example
Form Date: ______
ID: ______
Key ______
Comment: ___________________________

A B C D
1 Date ID Key Comment
2 2009/12 2345 29 house 24
3 2009/14 2342 2 garage 7
Now what I like some help on is that to enter two rows and four columns from
one form.
Form Date: ______ (98/4)
ID: ______ (77)
Key ______ (200)
Comment: ___________________________ (house 54)
Comment2: __________________________ (bray, lama)
A B C D
1 Date ID Key Comment
2 2009/12 2345 29 house 24
3 2009/14 2342 2 garage 7
4 98/4 77 200 house 54
5 98/4 77 200 bray, lama

At present moment the second comment overwrite the first. Ive played with
code but clearly do not understand it fully to make it work right.