Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default formula correct - display is funny

OK I've got a spreadsheet that reads the windows User Name and displays it
properly in the cell I choose. However when this is used to load data into
another program it grabs the cells content which is actually =UserNameWindows
()...
I need the other program to read the cell as the result of that formula.

This is how I get to the =UserNameWindows() result - any suggestions on how
to change the display? would be greatly appreciated...




Function UserNameWindows() As String
UserNameWindows = Environ("USERNAME")
End Function


Sub AutoFillIn()
Dim myNames As Variant
Dim c As Range
Dim res As Variant

myNames = Array("dadunlap", "slhull", "mdringler", _
"sljackson", "ccparker", "thenry", _
"rdowling", "jslong", "mhjames", _
"lndavis", "jdscott", "jfullem", _
"alwrinch")

For Each c In Range("A8:A1000")
If c.Value = "" Then
Exit For
End If
c.Offset(0, 8).Formula = "=UserNameWindows()"
res = Application.Match(UserNameWindows, myNames, 0)
If IsNumeric(res) Then
'found it
c.Offset(0, 6).Value = "YES"
Else
c.Offset(0, 6).Value = "NO"
End If
Next c
End Sub


TIA
Rebekah

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default formula correct - display is funny

Change the c.Offset(0, 8).Formula = "=UserNameWindows()"
to: c.Offset(0,8).value = UserNameWindows
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"RebekahK20_pontiac via OfficeKB.com" wrote:

OK I've got a spreadsheet that reads the windows User Name and displays it
properly in the cell I choose. However when this is used to load data into
another program it grabs the cells content which is actually =UserNameWindows
()...
I need the other program to read the cell as the result of that formula.

This is how I get to the =UserNameWindows() result - any suggestions on how
to change the display? would be greatly appreciated...




Function UserNameWindows() As String
UserNameWindows = Environ("USERNAME")
End Function


Sub AutoFillIn()
Dim myNames As Variant
Dim c As Range
Dim res As Variant

myNames = Array("dadunlap", "slhull", "mdringler", _
"sljackson", "ccparker", "thenry", _
"rdowling", "jslong", "mhjames", _
"lndavis", "jdscott", "jfullem", _
"alwrinch")

For Each c In Range("A8:A1000")
If c.Value = "" Then
Exit For
End If
c.Offset(0, 8).Formula = "=UserNameWindows()"
res = Application.Match(UserNameWindows, myNames, 0)
If IsNumeric(res) Then
'found it
c.Offset(0, 6).Value = "YES"
Else
c.Offset(0, 6).Value = "NO"
End If
Next c
End Sub


TIA
Rebekah

--
Message posted via http://www.officekb.com


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default formula correct - display is funny

This seems to work for me:

Function UserNameWindows() As String
UserNameWindows = Environ("USERNAME")
End Function


Sub AutoFillIn()
Dim myNames As Variant
Dim c As Range
Dim res As Variant

myNames = Array("dadunlap", "slhull", "mdringler", _
"sljackson", "ccparker", "thenry", _
"rdowling", "jslong", "mhjames", _
"lndavis", "jdscott", "jfullem", _
"alwrinch")

For Each c In Range("A8:A1000")
If c.Value = "" Then
Exit For
End If
c.Offset(0, 8).Formula = "=UserNameWindows()"
res = Application.Match(UserNameWindows, myNames, 0)
If IsNumeric(res) Then
'found it
c.Offset(0, 6).Value = "YES"
Else
c.Offset(0, 6).Value = "NO"
End If
Range("I8:I1000").Select
Selection.Copy
Range("I8").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A8").Select
Next c
End Sub
--
n00b lookn for a handout :)


"RebekahK20_pontiac via OfficeKB.com" wrote:

OK I've got a spreadsheet that reads the windows User Name and displays it
properly in the cell I choose. However when this is used to load data into
another program it grabs the cells content which is actually =UserNameWindows
()...
I need the other program to read the cell as the result of that formula.

This is how I get to the =UserNameWindows() result - any suggestions on how
to change the display? would be greatly appreciated...




Function UserNameWindows() As String
UserNameWindows = Environ("USERNAME")
End Function


Sub AutoFillIn()
Dim myNames As Variant
Dim c As Range
Dim res As Variant

myNames = Array("dadunlap", "slhull", "mdringler", _
"sljackson", "ccparker", "thenry", _
"rdowling", "jslong", "mhjames", _
"lndavis", "jdscott", "jfullem", _
"alwrinch")

For Each c In Range("A8:A1000")
If c.Value = "" Then
Exit For
End If
c.Offset(0, 8).Formula = "=UserNameWindows()"
res = Application.Match(UserNameWindows, myNames, 0)
If IsNumeric(res) Then
'found it
c.Offset(0, 6).Value = "YES"
Else
c.Offset(0, 6).Value = "NO"
End If
Next c
End Sub


TIA
Rebekah

--
Message posted via http://www.officekb.com


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default formula correct - display is funny

Thanks it worked perfectly... so simple too...

Rebekah

Michael wrote:
Change the c.Offset(0, 8).Formula = "=UserNameWindows()"
to: c.Offset(0,8).value = UserNameWindows
OK I've got a spreadsheet that reads the windows User Name and displays it
properly in the cell I choose. However when this is used to load data into

[quoted text clipped - 38 lines]
TIA
Rebekah


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200709/1

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
if conditions in 2 cell correct then display third cell Paul Hood New Users to Excel 3 January 21st 09 07:30 AM
Why does Regression tool in '07 not display Line Fit Plots correct Craig Excel Discussion (Misc queries) 1 August 2nd 08 08:35 PM
formatting a cell to display the correct date. Lee Excel Discussion (Misc queries) 1 February 23rd 06 04:04 PM
Accounting Category Display does not show the correct format/outpu per-ardua-ad-astra New Users to Excel 5 January 7th 06 01:30 PM
display correct toolbar icon on starting excel application program ilyaskazi[_24_] Excel Programming 10 June 15th 05 03:06 PM


All times are GMT +1. The time now is 08:50 PM.

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"