Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default A Login Macro, (Inputbox & MsgBox)..Need help with a counter.

Hi,

i written a macro where an inputbox retrives the user's name,
and then a welcome msg to the user is then displayed in a msgbox..

The names of the user's who enter their name in this login inputbox,
is compiled into row1 of a spreadsheet...

i was wondering if anyone could help tell me how i could,
take the data entry and ensure it doesnt repeat itself while it adds
to the rows...
example :- if the the macro below is used and the name Tim is used
3 times, it will appear from cell a1-a3 in the spreadsheet..

i was wondering how i could make it so that the names wont be repeated,
and a counter can be added on the next row of each name entry.

Basically i want my macro to be able to compile a list of users and the
number of times they logged in... not having duplicate entries as well..

could someone view my coding below n advice?

thanks awhole lot..!

__________________________________________________ ____________

Sub Login()
Dim Msg, Response
Dim Name As String

Name = InputBox("Enter Your Name")
Msg = "Welcome " & Name
Response = MsgBox(Msg)


Row = 1
ThisCell = Sheets("sheet1").Cells(Row, 1)
Do While ThisCell < ""
Row = Row + 1
ThisCell = Sheets("sheet1").Cells(Row, 1)
Loop
Sheets("sheet1").Cells(Row, 1) = Name

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default A Login Macro, (Inputbox & MsgBox)..Need help with a counter.

After the input box steps, add the following

================================================== ====================
If WorksheetFunction.CountIf(Name, Columns('input column number where names
are stored')) 0 then
' code to add count to existing name in list
Else
' code to add name to list
End If
==================

If the name list is in a single row:
If WorksheetFunction.CountIf(Name, Rows('input column number where names are
stored')) 0 then


to add count to an existing cell
Range("A1").Value = Range("A1").Value + 1

to find the row containing Name:
use a find function or a match function (in code)
--
steveB

Remove "AYN" from email to respond
"Max via OfficeKB.com" wrote in message
...
Hi,

i written a macro where an inputbox retrives the user's name,
and then a welcome msg to the user is then displayed in a msgbox..

The names of the user's who enter their name in this login inputbox,
is compiled into row1 of a spreadsheet...

i was wondering if anyone could help tell me how i could,
take the data entry and ensure it doesnt repeat itself while it adds
to the rows...
example :- if the the macro below is used and the name Tim is used
3 times, it will appear from cell a1-a3 in the spreadsheet..

i was wondering how i could make it so that the names wont be repeated,
and a counter can be added on the next row of each name entry.

Basically i want my macro to be able to compile a list of users and the
number of times they logged in... not having duplicate entries as well..

could someone view my coding below n advice?

thanks awhole lot..!

__________________________________________________ ____________

Sub Login()
Dim Msg, Response
Dim Name As String

Name = InputBox("Enter Your Name")
Msg = "Welcome " & Name
Response = MsgBox(Msg)


Row = 1
ThisCell = Sheets("sheet1").Cells(Row, 1)
Do While ThisCell < ""
Row = Row + 1
ThisCell = Sheets("sheet1").Cells(Row, 1)
Loop
Sheets("sheet1").Cells(Row, 1) = Name

End Sub



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
Help with InputBox and MsgBox Preschool Mike Excel Discussion (Misc queries) 9 April 14th 10 06:23 PM
Help with InputBox and MsgBox Ann New Users to Excel 2 April 11th 07 03:46 PM
msgbox / inputbox etc samenvoegen van sheets Excel Discussion (Misc queries) 2 March 16th 06 08:56 AM
msgbox / inputbox etc samenvoegen van sheets Excel Worksheet Functions 2 March 15th 06 04:28 PM
msgbox / inputbox etc samenvoegen van sheets Setting up and Configuration of Excel 1 March 15th 06 03:32 PM


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