Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi ,
My knowledge about excel programming is very limited. I have a sheet with months in the first row. The first column contains names of Products. The intervening grid contains the sales of these items for these months. A B C D E 1 APR MAY JUNE JULY 2 PRODUCT 1 3 PRODUCT 2 4 PRODUCT 3 5 PRODUCT 4 My userform has comboboxes "cboMonth" and "cboProduct".A text box "txtSales".I would like to enter data into the sheet depending on the selections of the two comboboxes.Example: if cboMonth.Value="MAY" AND cboProduct.Value ="PRODUCT 3" then the data from txtSales should get copied to the cell "C4". I am unable to link these using code.My sheet is very long with many products(and therefore many Rows).Hence a data entry form is very much useful . Please help. P.Jaimal |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Option Explicit
Private Sub CommandButton1_Click() Unload Me End Sub Private Sub CommandButton2_Click() Dim myCol As Variant Dim myRow As Variant With Worksheets("sheet1") 'whereever this table is. myCol = Application.Match(cboMonth.Value, .Rows(1), 0) myRow = Application.Match(cboProduct.Value, .Columns(1), 0) If IsNumeric(myCol) _ And IsNumeric(myRow) Then .Range("a1").Cells(myRow, myCol).Value = txtSales.Value Else Beep MsgBox "oopsie" End If End With End Sub You've posted this to several newsgroups. You may want to post response to those inquiries that you have an answer or at least an active thread in ..programming. It'll make less work for others--or may get you improved answers here. "P.Jaimal" wrote: Hi , My knowledge about excel programming is very limited. I have a sheet with months in the first row. The first column contains names of Products. The intervening grid contains the sales of these items for these months. A B C D E 1 APR MAY JUNE JULY 2 PRODUCT 1 3 PRODUCT 2 4 PRODUCT 3 5 PRODUCT 4 My userform has comboboxes "cboMonth" and "cboProduct".A text box "txtSales".I would like to enter data into the sheet depending on the selections of the two comboboxes.Example: if cboMonth.Value="MAY" AND cboProduct.Value ="PRODUCT 3" then the data from txtSales should get copied to the cell "C4". I am unable to link these using code.My sheet is very long with many products(and therefore many Rows).Hence a data entry form is very much useful . Please help. P.Jaimal -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks a lot Dave.The code works very well.I am sorry for the multiple
posts.I think that there was a problem somewhere the day I was posting the message.I was not getting the confirmation that my message was accepted.Hence the multiple posts.Thanks once again. P.Jaimal |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Form for data entry | Excel Discussion (Misc queries) | |||
Data Entry form | Excel Programming | |||
Data Entry Form (similar to default Excel DataForm) | Excel Programming | |||
data entry form | Excel Discussion (Misc queries) | |||
Data Entry on a Form | Excel Programming |