LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default What's wrong with my NextRow code?

I am new to VBA for Excel and hopefully some experts on the Forum can
help me solve the problem.

I try to use NextRow to insert data to the next available row and it is
not working.

The workbook has 4 worksheets. The User Form is on sheet REPORT (the
active sheet) and when user selects the “No” option button on one of
the questions in the UwerForm, a combo box appears and the data in the
combo box will be transferred to sheet RECAP starting from row D54. I
was able to transfer the data to the D column in sheet RECAP but
instead of D54, thge data was put in D55; the subsequent No answers put
the data in the wrong row as well.

Here is the code I wrote:

'Hide the combo box and the OK button after transferring respective
concern to "Recap"

Private Sub cmdCargoEnter_Click()

'Hide the frame
FrameConcernCargo.Visible = False

'Check for completeness
If cmbConcernCargo.Text = "" Then
MsgBox "You forgot to select the security concern"
FrameConcernCargo.Visible = True
End If

' Find next available row
NextRow = Sheets("Recap").Range("a53").Row + _
Sheets("Recap").Range("a53").CurrentRegion.Rows.Co unt

' Transfer the concern
Sheets("Recap").Cells(NextRow, 4) = cmbConcernCargo

' Reset the Userform for the next row
cmbConcernCargo = ""

End Sub

I attached two screenshots for reference


---
Message posted from http://www.ExcelForum.com/

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is wrong with this code? jlclyde Excel Discussion (Misc queries) 5 January 9th 08 05:12 PM
What is wrong with the code? Eric Excel Discussion (Misc queries) 2 September 13th 07 10:36 AM
Can someone tell me what is wrong with this code? Ant Excel Discussion (Misc queries) 8 November 14th 05 02:53 PM
What's wrong with my code ? christophe meresse Excel Worksheet Functions 3 August 2nd 05 05:09 PM
Is something wrong with the code Patrick Molloy[_3_] Excel Programming 1 July 15th 03 08:28 AM


All times are GMT +1. The time now is 06:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"