Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Vicky
 
Posts: n/a
Default How do i fill the adjacent cell formulas in user form when i press

Hi,
Help in this regards are welcome.
I have created a user form for which the coding has been done. The adjacent
cells are having formulas. Now i wish to fill the formulas of the adjacent
cells upto the last filled row whenever i press the add button.
For the ready ref. here is the coding of the User Form :

Private Sub cmdAdd_Click()
Dim irow As Long
Dim ws As Worksheet
Set ws = Worksheets("DBASE")

irow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

If Trim(Me.txtInv.Value) = "" Then

Me.txtInv.SetFocus

MsgBox "Please enter the Invoice number"

Exit Sub

End If
ws.Cells(irow, 1).Value = Me.txtInv.Value
ws.Cells(irow, 2).Value = Me.txtDate.Value
ws.Cells(irow, 3).Value = Me.cboCust.Value
ws.Cells(irow, 4).Value = Me.cboImCode.Value
ws.Cells(irow, 5).Value = Me.txtQty.Value
ws.Cells(irow, 6).Value = Me.txtPack.Value
ws.Cells(irow, 7).Value = Me.txtRate.Value
ws.Cells(irow, 8).Value = Me.txtContainer.Value
ws.Cells(irow, 9).Value = Me.txtSeal.Value
ws.Cells(irow, 10).Value = Me.optAir.Value
ws.Cells(irow, 10).Value = Me.optSea.Value

Me.txtInv.Value = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(0, 0).Value
Me.txtDate.Value = Format(Date, "dd/mm/yyyy")
Me.cboCust.Value = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(0, 2).Value
Me.cboImCode.Value = ""
Me.txtQty.Value = ""
Me.txtPack.Value = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(0, 5).Value
Me.txtRate.Value = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(0, 6).Value
Me.txtContainer.Value = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(0, 7).Value
Me.txtSeal.Value = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(0, 8).Value
If optSea = True Then
ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(0, 9).Value = "SEA"
ElseIf optAir = True Then
ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(0, 9).Value = "AIR"

End If
Me.txtInv.SetFocus
End Sub

Private Sub cmdClose_Click()
Unload Me
End Sub

Private Sub Lable_Click()

End Sub

Private Sub UserForm_queryclose(cancel As Integer, _
closemode As Integer)
If closemode = vbFormControlMenu Then
cancel = True
MsgBox "Please use the button"
End If
End Sub
Private Sub UserForm_Initialize()
Dim cCust As Range
Dim cParts As Range
Dim ws As Worksheet
Set ws = Worksheets("DBASE")
Set wss = Worksheets("Cust Master")
Set wsss = Worksheets("Im Master")

Me.txtInv.SetFocus

For Each cCust In wss.Range("CustID")
With Me.cboCust
.AddItem cCust.Value
.List(.ListCount - 1, 1) = cCust.Offset(0, 1).Value
End With
Next cCust

For Each cParts In wsss.Range("PartsID")
With Me.cboImCode
.AddItem cParts.Value
.List(.ListCount - 1, 1) = cParts.Offset(0, 1).Value
End With
Next cParts

Me.txtInv.Value = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(0, 0).Value
Me.txtDate.Value = Format(Date, "dd/mm/yyyy")
Me.cboCust.Value = ""
Me.cboImCode.Value = ""
Me.txtQty.Value = ""
Me.txtPack.Value = ""
Me.txtRate.Value = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(0, 6).Value
Me.txtContainer.Value = ""
Me.txtSeal.Value = ""

Me.txtInv.SetFocus
End Sub
================================================== ==
Looking forward for the valuable suggestion in this regard.

--
Vikram Dhemare
Reply
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
user form question: text box to display result BigPig Excel Worksheet Functions 0 February 25th 06 08:17 PM
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
How do I automatically fill a cell based on another cell in Excel SouthCarolina Excel Discussion (Misc queries) 3 January 13th 06 12:52 AM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
Identifying the Active Fill Color Steve Conary Excel Discussion (Misc queries) 3 December 9th 04 04:45 AM


All times are GMT +1. The time now is 11:09 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"