Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Everyone,
I (as you will soon discover) am extremly new to VBA and I desperatly need some advice. I am currenty writing (in EXCEL) a User interface to create a work order with work order details (Product 1, 2, 3, Etc.). I then need to send the varying range of cells to a CSV file. Because the number of products will Vary, the number of columns will vary. This will create a Variance in the Range. Any suggestions on how to capture this? (I am Including my code for the frmOrdDetail) Any help would be appreciated, Thanks, Gary ' Declare my Variables Dim ColNum As Integer Dim Row As Integer Dim flgNext As Boolean Private Sub cmdExit_Click() Unload Me End Sub Private Sub cmdSubmit_Click() ' Make sure sheet1 is active Sheets("Orders").Activate NextRow = _ Application.WorksheetFunction.CountA(Range("A:A")) 'Flag Next? If flgNext Then ColNum = ColNum + 3 Else ColNum = 16 End If ' Make sure that all needed fields are completed ' Product Number If txtProdNum.Text = "" Then MsgBox "You must enter a Product Number" txtProdNum.SetFocus Exit Sub End If ' Description If txtProdDesc.Text = "" Then MsgBox "You must enter a Description!" txtProdDesc.SetFocus Exit Sub End If ' Quantity If txtQty.Text = "" Then MsgBox "You must enter a Quantity!" txtQty.SetFocus Exit Sub End If ' Transfer the Product Number Cells(NextRow, ColNum) = txtProdNum.Text ' Transfer the Product Description Cells(NextRow, ColNum + 1) = txtProdDesc.Text ' Transfer Qty Cells(NextRow, (ColNum + 2)) = txtQty.Text NextLine = MsgBox("Would you like to enter another Product?", vbYesNo) If NextLine = vbYes Then txtProdNum.Text = "" txtProdDesc.Text = "" txtQty.Text = "" txtProdNum.SetFocus flgNext = True Else cmdSubmit.Visible = False cmdTransfer.Visible = True flgNext = False End If End Sub Private Sub cmdTransfer_Click() ' This is Where I am StucK End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Exporting to CSV file | Excel Discussion (Misc queries) | |||
Exporting a PDF file | Excel Discussion (Misc queries) | |||
Exporting to csv file | Excel Discussion (Misc queries) | |||
File opening via Macro with varying file name | Excel Programming | |||
Exporting CSV file to unicode .txt file - " around strings | Excel Discussion (Misc queries) |