PC Review


Reply
Thread Tools Rate Thread

Appending cboBox values into cells

 
 
=?Utf-8?B?Q01jSw==?=
Guest
Posts: n/a
 
      22nd Oct 2006
Hi,

I'm working on a a usrFrm which appends cboBox values into cells when the
'Submit' button is clicked.
I want to be able to change the project name (cboBox value) and append fresh
data (values of txtBox & cboBox) in the next row down when the 'Submit'
button is pressed again, and so on (upto 50 times).

Any help would be very much appreciated.

I have written the below code to append the first line of data:

Private Sub cmdSubmit_Click()

Dim wb As Workbook
Dim ws As Worksheet

Set wb = ThisWorkbook
Set ws = wb.Sheets("Timesheet")

ws.Activate

ws.Cells(9, 2).Value = Me.cboProjectName.Text
ws.Cells(9, 3).Value = Me.txtProjectNumber.Text
ws.Cells(9, 4).Value = Me.cboProjectPhase.Text
ws.Cells(9, 7).Value = Me.cboMon.Text
ws.Cells(9, 8).Value = Me.cboTues.Text
ws.Cells(9, 9).Value = Me.cboWed.Text
ws.Cells(9, 10).Value = Me.cboThurs.Text
ws.Cells(9, 11).Value = Me.cboFri.Text
ws.Cells(9, 5).Value = Me.cboSat.Text
ws.Cells(9, 6).Value = Me.cboSun.Text

End Sub





 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      22nd Oct 2006
Untested...

Private Sub cmdSubmit_Click()

Dim wb As Workbook
Dim ws As Worksheet
Dim NextRow as long

Set wb = ThisWorkbook
Set ws = wb.Sheets("Timesheet")

if me.cboprojectname.text = "" then
msgbox "Please complete the project name!"
exit sub
end if

'no need to activate
'ws.Activate

with ws
nextrow = .cells(.rows.count,2).end(xlup).row + 1

.Cells(nextrow, 2).Value = Me.cboProjectName.Text
.Cells(nextrow, 3).Value = Me.txtProjectNumber.Text
.Cells(nextrow, 4).Value = Me.cboProjectPhase.Text
.Cells(nextrow, 7).Value = Me.cboMon.Text
.Cells(nextrow, 8).Value = Me.cboTues.Text
.Cells(nextrow, 9).Value = Me.cboWed.Text
.Cells(nextrow, 10).Value = Me.cboThurs.Text
.Cells(nextrow, 11).Value = Me.cboFri.Text
.Cells(nextrow, 5).Value = Me.cboSat.Text
.Cells(nextrow, 6).Value = Me.cboSun.Text
end with

End Sub

I used column B to find the next available row. So the project name has to be
filled in.

CMcK wrote:
>
> Hi,
>
> I'm working on a a usrFrm which appends cboBox values into cells when the
> 'Submit' button is clicked.
> I want to be able to change the project name (cboBox value) and append fresh
> data (values of txtBox & cboBox) in the next row down when the 'Submit'
> button is pressed again, and so on (upto 50 times).
>
> Any help would be very much appreciated.
>
> I have written the below code to append the first line of data:
>
> Private Sub cmdSubmit_Click()
>
> Dim wb As Workbook
> Dim ws As Worksheet
>
> Set wb = ThisWorkbook
> Set ws = wb.Sheets("Timesheet")
>
> ws.Activate
>
> ws.Cells(9, 2).Value = Me.cboProjectName.Text
> ws.Cells(9, 3).Value = Me.txtProjectNumber.Text
> ws.Cells(9, 4).Value = Me.cboProjectPhase.Text
> ws.Cells(9, 7).Value = Me.cboMon.Text
> ws.Cells(9, 8).Value = Me.cboTues.Text
> ws.Cells(9, 9).Value = Me.cboWed.Text
> ws.Cells(9, 10).Value = Me.cboThurs.Text
> ws.Cells(9, 11).Value = Me.cboFri.Text
> ws.Cells(9, 5).Value = Me.cboSat.Text
> ws.Cells(9, 6).Value = Me.cboSun.Text
>
> End Sub


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?Q01jSw==?=
Guest
Posts: n/a
 
      22nd Oct 2006
Dave,
First up, thanks for your reply.
I have run it and unfortunately it's not working. It would appear that each
time the @submit' buttonis prssed, it over-writes existing data instead of
populating the next row down. Any idea why?
Thanks.
CMcK


"Dave Peterson" wrote:

> Untested...
>
> Private Sub cmdSubmit_Click()
>
> Dim wb As Workbook
> Dim ws As Worksheet
> Dim NextRow as long
>
> Set wb = ThisWorkbook
> Set ws = wb.Sheets("Timesheet")
>
> if me.cboprojectname.text = "" then
> msgbox "Please complete the project name!"
> exit sub
> end if
>
> 'no need to activate
> 'ws.Activate
>
> with ws
> nextrow = .cells(.rows.count,2).end(xlup).row + 1
>
> .Cells(nextrow, 2).Value = Me.cboProjectName.Text
> .Cells(nextrow, 3).Value = Me.txtProjectNumber.Text
> .Cells(nextrow, 4).Value = Me.cboProjectPhase.Text
> .Cells(nextrow, 7).Value = Me.cboMon.Text
> .Cells(nextrow, 8).Value = Me.cboTues.Text
> .Cells(nextrow, 9).Value = Me.cboWed.Text
> .Cells(nextrow, 10).Value = Me.cboThurs.Text
> .Cells(nextrow, 11).Value = Me.cboFri.Text
> .Cells(nextrow, 5).Value = Me.cboSat.Text
> .Cells(nextrow, 6).Value = Me.cboSun.Text
> end with
>
> End Sub
>
> I used column B to find the next available row. So the project name has to be
> filled in.
>
> CMcK wrote:
> >
> > Hi,
> >
> > I'm working on a a usrFrm which appends cboBox values into cells when the
> > 'Submit' button is clicked.
> > I want to be able to change the project name (cboBox value) and append fresh
> > data (values of txtBox & cboBox) in the next row down when the 'Submit'
> > button is pressed again, and so on (upto 50 times).
> >
> > Any help would be very much appreciated.
> >
> > I have written the below code to append the first line of data:
> >
> > Private Sub cmdSubmit_Click()
> >
> > Dim wb As Workbook
> > Dim ws As Worksheet
> >
> > Set wb = ThisWorkbook
> > Set ws = wb.Sheets("Timesheet")
> >
> > ws.Activate
> >
> > ws.Cells(9, 2).Value = Me.cboProjectName.Text
> > ws.Cells(9, 3).Value = Me.txtProjectNumber.Text
> > ws.Cells(9, 4).Value = Me.cboProjectPhase.Text
> > ws.Cells(9, 7).Value = Me.cboMon.Text
> > ws.Cells(9, 8).Value = Me.cboTues.Text
> > ws.Cells(9, 9).Value = Me.cboWed.Text
> > ws.Cells(9, 10).Value = Me.cboThurs.Text
> > ws.Cells(9, 11).Value = Me.cboFri.Text
> > ws.Cells(9, 5).Value = Me.cboSat.Text
> > ws.Cells(9, 6).Value = Me.cboSun.Text
> >
> > End Sub

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
=?Utf-8?B?Q01jSw==?=
Guest
Posts: n/a
 
      22nd Oct 2006
Dave,

I've figured out why it doesn't work - it was a typo on my part.
Really do appreciate your help. THANK YOU!!!

CMcK

"Dave Peterson" wrote:

> Untested...
>
> Private Sub cmdSubmit_Click()
>
> Dim wb As Workbook
> Dim ws As Worksheet
> Dim NextRow as long
>
> Set wb = ThisWorkbook
> Set ws = wb.Sheets("Timesheet")
>
> if me.cboprojectname.text = "" then
> msgbox "Please complete the project name!"
> exit sub
> end if
>
> 'no need to activate
> 'ws.Activate
>
> with ws
> nextrow = .cells(.rows.count,2).end(xlup).row + 1
>
> .Cells(nextrow, 2).Value = Me.cboProjectName.Text
> .Cells(nextrow, 3).Value = Me.txtProjectNumber.Text
> .Cells(nextrow, 4).Value = Me.cboProjectPhase.Text
> .Cells(nextrow, 7).Value = Me.cboMon.Text
> .Cells(nextrow, 8).Value = Me.cboTues.Text
> .Cells(nextrow, 9).Value = Me.cboWed.Text
> .Cells(nextrow, 10).Value = Me.cboThurs.Text
> .Cells(nextrow, 11).Value = Me.cboFri.Text
> .Cells(nextrow, 5).Value = Me.cboSat.Text
> .Cells(nextrow, 6).Value = Me.cboSun.Text
> end with
>
> End Sub
>
> I used column B to find the next available row. So the project name has to be
> filled in.
>
> CMcK wrote:
> >
> > Hi,
> >
> > I'm working on a a usrFrm which appends cboBox values into cells when the
> > 'Submit' button is clicked.
> > I want to be able to change the project name (cboBox value) and append fresh
> > data (values of txtBox & cboBox) in the next row down when the 'Submit'
> > button is pressed again, and so on (upto 50 times).
> >
> > Any help would be very much appreciated.
> >
> > I have written the below code to append the first line of data:
> >
> > Private Sub cmdSubmit_Click()
> >
> > Dim wb As Workbook
> > Dim ws As Worksheet
> >
> > Set wb = ThisWorkbook
> > Set ws = wb.Sheets("Timesheet")
> >
> > ws.Activate
> >
> > ws.Cells(9, 2).Value = Me.cboProjectName.Text
> > ws.Cells(9, 3).Value = Me.txtProjectNumber.Text
> > ws.Cells(9, 4).Value = Me.cboProjectPhase.Text
> > ws.Cells(9, 7).Value = Me.cboMon.Text
> > ws.Cells(9, 8).Value = Me.cboTues.Text
> > ws.Cells(9, 9).Value = Me.cboWed.Text
> > ws.Cells(9, 10).Value = Me.cboThurs.Text
> > ws.Cells(9, 11).Value = Me.cboFri.Text
> > ws.Cells(9, 5).Value = Me.cboSat.Text
> > ws.Cells(9, 6).Value = Me.cboSun.Text
> >
> > End Sub

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate data in cboBox from another cboBox SoggyCashew Microsoft Access Getting Started 2 5th Nov 2008 06:17 PM
Appending Values in the Legend =?Utf-8?B?UGhpbCBIYWdlbWFu?= Microsoft Excel Charting 1 3rd Oct 2005 08:16 PM
cbobox that has duplicate values? =?Utf-8?B?QnJvb2s=?= Microsoft Access Form Coding 2 15th Apr 2005 02:05 AM
cboBox values MBison80 Microsoft Access 2 10th Apr 2004 08:07 AM
Populate 2nd cbobox after selection in 1st cbobox Evan McCutchen Microsoft Access Form Coding 2 7th Apr 2004 04:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:58 PM.