Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userforms & worksheets
In a textbox on a userform I want to display the next available number from
the worksheet "CD" - column A. Column A is sequentially numbered so essentially it would be LastRow + 1 I can get the date and time and usernames in other text boxes on the user form (i.e. UserForm1.TextBox21.Value = UserName()) but I am having trouble with this number Any ideas? -- Traa Dy Liooar Jock |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userforms & worksheets
This could probably be made to look neater, but
it should work. lastRow =Worksheets("CD").Cells(Rows.Count, 1) _ ..End(xlUp).Row Sheets("CD").Range("A" & lastRow + 1) = _ Sheets("CD").Range("A" & lastRow).Value + 1 UserForm1.TextBox22.Value = Worksheets("CD") _ ..Range("A" & lastRow + 1).Value "Jock" wrote: In a textbox on a userform I want to display the next available number from the worksheet "CD" - column A. Column A is sequentially numbered so essentially it would be LastRow + 1 I can get the date and time and usernames in other text boxes on the user form (i.e. UserForm1.TextBox21.Value = UserName()) but I am having trouble with this number Any ideas? -- Traa Dy Liooar Jock |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userforms & worksheets
sir i have code for data entry in worksheet is as under , please mail me code
for edit the data in worksheet form. Sub UpdateLogWorksheet() 'http://www.contextures.com/xlForm02.html 'code by Dave Peterson Dim historyWks As Worksheet Dim inputWks As Worksheet Dim nextRow As Long Dim oCol As Long Dim myRng As Range Dim myCopy As String Dim myCell As Range 'cells to copy from Input sheet - some contain formulas myCopy = "D5,D7,D9,D11,D13" Set inputWks = Worksheets("Input") Set historyWks = Worksheets("PartsData") With historyWks nextRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row End With With inputWks Set myRng = .Range(myCopy) If Application.CountA(myRng) < myRng.Cells.Count Then MsgBox "Please fill in all the cells!" Exit Sub End If End With With historyWks With .Cells(nextRow, "A") .Value = Now .NumberFormat = "mm/dd/yyyy hh:mm:ss" End With .Cells(nextRow, "B").Value = Application.UserName oCol = 3 For Each myCell In myRng.Cells historyWks.Cells(nextRow, oCol).Value = myCell.Value oCol = oCol + 1 Next myCell End With 'clear input cells that contain constants With inputWks On Error Resume Next With .Range(myCopy).Cells.SpecialCells(xlCellTypeConsta nts) .ClearContents Application.Goto .Cells(1) ', Scroll:=True End With On Error GoTo 0 End With End Sub thanks "JLGWhiz" wrote: This could probably be made to look neater, but it should work. lastRow =Worksheets("CD").Cells(Rows.Count, 1) _ .End(xlUp).Row Sheets("CD").Range("A" & lastRow + 1) = _ Sheets("CD").Range("A" & lastRow).Value + 1 UserForm1.TextBox22.Value = Worksheets("CD") _ .Range("A" & lastRow + 1).Value "Jock" wrote: In a textbox on a userform I want to display the next available number from the worksheet "CD" - column A. Column A is sequentially numbered so essentially it would be LastRow + 1 I can get the date and time and usernames in other text boxes on the user form (i.e. UserForm1.TextBox21.Value = UserName()) but I am having trouble with this number Any ideas? -- Traa Dy Liooar Jock |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
UserForms and double-clicked worksheets... | Excel Programming | |||
Userforms | Excel Programming | |||
Userforms | Excel Programming | |||
userforms / worksheets | Excel Programming | |||
userforms again... | Excel Programming |