Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
here is the unworking script:
Private Sub Workbook_open() Worksheets("Frontscreen").Activate ActiveSheet.Unprotect Dim x Set x = CreateObject("WSCRIPT.Network") Dim u u = x.UserName t = Time 'update text box "Last Updated:" ActiveSheet.TextBoxes("txtLogon").Text = "Welcome to IRIS " & u & " - Access Time: " & t ActiveSheet.Protect lastrow = Worksheets("log").Cells(Rows.Count, "A").End(xlUp).Row Loglisting = txtLogon.Value Worksheets("Log").Range("A" & lastrow + 1).Value = Loglisting End Sub Basically when workbook opens the current user is identified and displayed using text box. I want this value to be copied to the next available line in a log worksheet that is hidden from the user. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Which bit is not working? There is a simpler way to get the user
Private Sub Workbook_open() Worksheets("Frontscreen").Activate ActiveSheet.Unprotect Dim u u = Environ("Username") t = Time 'update text box "Last Updated:" ActiveSheet.TextBoxes("txtLogon").Text = "Welcome to IRIS " & _ u & " - Access Time: " & t ActiveSheet.Protect lastrow = Worksheets("log").Cells(Rows.Count, "A").End(xlUp).Row Loglisting = txtLogon.Value Worksheets("Log").Range("A" & lastrow + 1).Value = Loglisting End Sub -- HTH Bob Phillips (remove nothere from email address if mailing direct) "sacrum" wrote in message ... here is the unworking script: Private Sub Workbook_open() Worksheets("Frontscreen").Activate ActiveSheet.Unprotect Dim x Set x = CreateObject("WSCRIPT.Network") Dim u u = x.UserName t = Time 'update text box "Last Updated:" ActiveSheet.TextBoxes("txtLogon").Text = "Welcome to IRIS " & u & " - Access Time: " & t ActiveSheet.Protect lastrow = Worksheets("log").Cells(Rows.Count, "A").End(xlUp).Row Loglisting = txtLogon.Value Worksheets("Log").Range("A" & lastrow + 1).Value = Loglisting End Sub Basically when workbook opens the current user is identified and displayed using text box. I want this value to be copied to the next available line in a log worksheet that is hidden from the user. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() lastrow = Worksheets("log").Cells(Rows.Count, "A").End(xlUp).Row Loglisting = txtLogon.Value Worksheets("Log").Range("A" & lastrow + 1).Value = Loglisting End Sub Its this last bit that causes a run time error - I have created a log worksheet and the code above is located in ThisWorkbook visible in vb editor. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I suggest you use If IsEmpty(Range("A2")) Then Sheets("Log").Range("A2").Value = Loglisting Else Sheets("Log").Range("A1").End(xlDown).Offset(1, 0).Value = Loglisting End If for the last bit Where I am presumming that you have a header in cell A1 on sheet Log Hoop this helps, Executor |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What are all the variable values at that point, lastrow, Loglisting, etc.?
-- HTH Bob Phillips (remove nothere from email address if mailing direct) "sacrum" wrote in message ... lastrow = Worksheets("log").Cells(Rows.Count, "A").End(xlUp).Row Loglisting = txtLogon.Value Worksheets("Log").Range("A" & lastrow + 1).Value = Loglisting End Sub Its this last bit that causes a run time error - I have created a log worksheet and the code above is located in ThisWorkbook visible in vb editor. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Bob Phillips" wrote in message ... What are all the variable values at that point, lastrow, Loglisting, etc.? -- HTH Bob Phillips (remove nothere from email address if mailing direct) "sacrum" wrote in message ... lastrow = Worksheets("log").Cells(Rows.Count, "A").End(xlUp).Row Loglisting = txtLogon.Value Worksheets("Log").Range("A" & lastrow + 1).Value = Loglisting End Sub Its this last bit that causes a run time error - I have created a log worksheet and the code above is located in ThisWorkbook visible in vb editor. vb runs through (below) but nothing happens in the log sheet - do I need to do anything in the log sheet....? Private Sub Workbook_open() Worksheets("Frontscreen").Activate ActiveSheet.Unprotect Dim u u = Environ("Username") t = Time 'update text box "Last Updated:" ActiveSheet.TextBoxes("txtLogon").Text = "Welcome to IRIS " & u & " - Access Time: " & t ActiveSheet.Protect Dim Loglisting If IsEmpty(Range("A2")) Then Sheets("Log").Range("A2").Value = Loglisting Else Sheets("Log").Range("A1").End(xlDown).Offset(1, 0).Value = Loglisting End If End Sub |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
which answers none of the questions I asked!
-- HTH Bob Phillips (remove nothere from email address if mailing direct) "sacrum" wrote in message ... "Bob Phillips" wrote in message ... What are all the variable values at that point, lastrow, Loglisting, etc.? -- HTH Bob Phillips (remove nothere from email address if mailing direct) "sacrum" wrote in message ... lastrow = Worksheets("log").Cells(Rows.Count, "A").End(xlUp).Row Loglisting = txtLogon.Value Worksheets("Log").Range("A" & lastrow + 1).Value = Loglisting End Sub Its this last bit that causes a run time error - I have created a log worksheet and the code above is located in ThisWorkbook visible in vb editor. vb runs through (below) but nothing happens in the log sheet - do I need to do anything in the log sheet....? Private Sub Workbook_open() Worksheets("Frontscreen").Activate ActiveSheet.Unprotect Dim u u = Environ("Username") t = Time 'update text box "Last Updated:" ActiveSheet.TextBoxes("txtLogon").Text = "Welcome to IRIS " & u & " - Access Time: " & t ActiveSheet.Protect Dim Loglisting If IsEmpty(Range("A2")) Then Sheets("Log").Range("A2").Value = Loglisting Else Sheets("Log").Range("A1").End(xlDown).Offset(1, 0).Value = Loglisting End If End Sub |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
And you have more responses at your thread in .misc.
sacrum wrote: here is the unworking script: Private Sub Workbook_open() Worksheets("Frontscreen").Activate ActiveSheet.Unprotect Dim x Set x = CreateObject("WSCRIPT.Network") Dim u u = x.UserName t = Time 'update text box "Last Updated:" ActiveSheet.TextBoxes("txtLogon").Text = "Welcome to IRIS " & u & " - Access Time: " & t ActiveSheet.Protect lastrow = Worksheets("log").Cells(Rows.Count, "A").End(xlUp).Row Loglisting = txtLogon.Value Worksheets("Log").Range("A" & lastrow + 1).Value = Loglisting End Sub Basically when workbook opens the current user is identified and displayed using text box. I want this value to be copied to the next available line in a log worksheet that is hidden from the user. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Allow only writing in a protected Sheet | Setting up and Configuration of Excel | |||
Writing formulas between sheet | Excel Discussion (Misc queries) | |||
Writing value in cell in another sheet | Excel Programming | |||
Writing to protected sheet from ASP.NET | Excel Programming | |||
Writing to protected sheet from ASP.NET | Excel Programming |