Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 440
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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
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
UserForms and double-clicked worksheets... Dan Excel Programming 1 March 18th 06 05:35 AM
Userforms restrepoblessin Excel Programming 1 September 12th 05 04:26 PM
Userforms carlito_1985[_4_] Excel Programming 2 September 12th 05 09:04 AM
userforms / worksheets Gixxer_J_97[_2_] Excel Programming 5 March 9th 05 01:25 AM
userforms again... Jo[_4_] Excel Programming 3 September 21st 03 12:31 AM


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