Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Margaret Moore   on Jan 13 In MS Office Category.

  
Question Answered By: Noah Evans   on Jan 13

In case if anyone needed the answer for
themselves here is how I did it.

Option Explicit

Dim username As String
Dim passNum As String
Dim passName As String
Dim password As String

Sub CommandButton1_Click()
Call createUsername
Call createPassword
Call moveActiveDate
Call moveActivePW
End Sub

Sub moveActiveDate()
Worksheets("Password Generator").Activate

If Range("G4").Value = " " Then
Range("G4").Activate
Else
Cells(Rows.Count, "G").End(xlUp).Offset(1, 0).Select
End If

ActiveCell.Value = Date
End Sub

Sub moveActivePW()
Worksheets("Password Generator").Activate

If Range("H4").Value = " " Then
Range("H4").Activate
Else
Cells(Rows.Count, "H").End(xlUp).Offset(1, 0).Select
End If

ActiveCell.Value = password
End Sub

Sub createPassword()
Randomize
passNum = CStr(Int(100000 + (Rnd * 900000)))
passName = "pcla"
password = passName + passNum

Worksheets("Password Generator").Range("E13").Value = password
End Sub

Sub createUsername()
username = "pcla"
Worksheets("Password Generator").Range("E12").Value = username
End Sub

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on dates in excel sheet Or get search suggestion and latest updates.


Tagged: