Here is what I'd do, if you are permitted. If you have 10 users, create 10
spreadsheets, one for each user. In that sheet, create an odbc-link to that
specific user's spreadsheet. Or if you can only have 1 workbook, I'd then
have 10 sheets in it, one for each user, again with their unique table
linked. Here is how to create that link:
Data>Import External Data>New Database Query. Then select MS Access
DataBase. Then point the file and select the table. When a user opens the
spreadsheet, I'd have a startup macro read the user name, and then hide all
sheets but his, which I'd refresh and display. Here is the code for all that:
Option Explicit
'Then place this on the workbook_Open()
Private Sub Workbook_Open()
Usrid = fOSUserName
Usrid = LCase(Usrid)
For Each wSheet In Worksheets
wSheet.visible=false
Next wSheet
Sheets(usrid).Visible = true 'unhide the one for the person who just opened
this xls file....
cells(1,1).select
Selection.QueryTable.Refresh BackgroundQuery:=False
'the above assumes that the external data is in cell a1 on each sheet.
adjust accordingly...
'******************** Code Start **************************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function APIGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = APIGetUserName(strUserName, lngLen)
If (lngX > 0) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
If LCase(fOSUserName) = "mhirsch" Then
Let FirstName = "Mike"
ElseIf LCase(fOSUserName) = "msmoot" Then
Let FirstName = "Mark"
ElseIf LCase(fOSUserName) = "lpowell" Then
Let FirstName = "Linda"
ElseIf LCase(fOSUserName) = "cspurgeon" Then
Let FirstName = "Carla"
ElseIf LCase(fOSUserName) = "jkail" Then
Let FirstName = "Judy"
ElseIf LCase(fOSUserName) = "lgoldman" Then
Let FirstName = "Lyn"
ElseIf LCase(fOSUserName) = "jkendall" Then
Let FirstName = "Jennifer"
'ElseIf LCase(fOSUserName) = "" Then
' Let FirstName = ""
'ElseIf LCase(fOSUserName) = "" Then
' Let FirstName = ""
Else
Let FirstName = "User"
End If
End Function
'******************** Code End **************************