Thread: vba/macro code
View Single Post
  #1   Report Post  
JSHARP92 JSHARP92 is offline
Junior Member
 
Posts: 4
Unhappy vba/macro code

ive been given instructions to create a macro which will be used on a form to add a new user to a system. Could somebody please help me with writing out this code? the steps are below, thank you to anybody who helps me with this


Create a macro that will add the username and password to the UserDetails worksheet. You will need to include code for the following stages:

* Declare the variables that you need. (Row, RowNum, NumUsers as Integer and Cellref, Cellref2, pword and uname as String)
* Assign values to the NumUser, pword and uname variables from the named ranges on the worksheet.
* Store the value 1 in the RowNum variable.
* Move to the UserDetails worksheet.
* Start a For Next loop that loops from 1 to NumUsers. (For Row = 1 to NumUsers)
* Generate the cell references for username and password and store these in variables. (you need two)
* Use an If statement to enter the password and username into the first available row, move back to the log in form and display a confirmation message if the cell is empty and and adds 1 to the Row Number if it is not empty.
* Loops to next row. (Next Row)