Chad,
That would be the best way I can think of to do that, because it keeps the
integrity of the data within the middle of the string as well that could
be used in other situations where you would need to move the minus sign
from the last char within the string to the beginning.
The only real thing I would change is to put that into a function so you
could just pass the parameter to the function and get the value back in 1
go.
Function MoveMinus(WhatString as string) as String
Dim tmpStr as String
tmpStr = Trim$(WhatString)
If Right$(tmpStr,1) = "-" then
tmpStr = "-" & Mid$(tmpStr,1,Len(tmpStr)-1)
End If
MoveMinus = tmpStr
End Function
and then to call it you just use this
sAmt = MoveMinus(View(Row:=2, Col:=13, Length:=10))
...................................
Brian Van Grinsven, MCP
Integrated Systems Specialist
Medbuy Corporation
[email protected]
www.medbuy.ca
Tel: 519.652.1688 ext. 114
Fax: 519.652.2788
Building Partnerships in Healthcare
[email protected]
03/19/2009 11:42 AM
Please respond to
[email protected]
To
[email protected]
cc
Subject
[talkbws] Re: String Function
Any experts out there please don't laugh, I'm sure there is a better way.
Just off the top of my head I would do something like this...
Dim sAmt As String
sAmt = Trim$(View(Row:=2, Col:=13, Length:=10))
IF Right$(sAmt,1) = "-" then sAmt = "-" & Mid$(sAmt,1,Len(sAmt)-1)
' example String pulled would be "99.99- "
' The Trim$ Function removes the 4 spaces to the right of the minus sign,
' so the value returned would be "99.99-"
' If statement checks to see if last character is a minus sign
' if so moves the minus to the front of the string
Chad Arrants
Data Management Finance\IT
Kershaw County Medical Center
Work: 803-713-6267
Pager: 803-424-2153
Cell: 803-210-5756
>>> <[email protected]> 3/19/2009 11:17 AM >>>
I am viewing a string on my screen and b/c STAR is stupid a negative
number shows up as 99.99-. Well excel doesn’t like that, so I need a
function that will move the negative to the front of the number if it is
present. Can anyone help with this? I know how to replace a character; I
just don’t know how to move it. I thought about just viewing that last
character separately and always putting it on front, but it is left
justified on the screen and I never know how many numbers are going to be
in front of it ahead of time. Any help is greatly appreciated.
Thanks,
Reese
Reese E. Walker
Lead Financial Systems Analyst
Manager, Phoebe Cares Dept.
Phoebe Putney Memorial Hospital
Albany, GA. 31702
Phone: (229) 312-4259
Pager: (229) 431-7658
Fax: (229) 312-4316
Disclaimer:
The HIPAA Final Privacy Rule requires covered entities to safeguard
certain Protected Health Information (PHI) related to a person's
healthcare. Information being faxed to you may include PHI after
appropriate authorization from the patient or under circumstances
that do not require patient authorization. You, the recipient, are
obligated to maintain PHI in a safe and secure manner. You may not
re-disclose without additional patient consent or as required by
law. Unauthorized re-disclosure or failure to safeguard PHI could
subject you to penalties described in federal (HIPAA) and state
law. If you the reader of this message are not the intended
recipient, or the employee or agent responsible to deliver it to
the intended recipient, please notify us immediately and destroy
the related message.
---
To post a message to this list, send mail to: [email protected]
You are currently subscribed as: [email protected]
Unsubscribe in the customer center on our website:
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk.aspx
---
To post a message to this list, send mail to: [email protected]
You are currently subscribed as: [email protected]
Unsubscribe in the customer center on our website:
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk.aspx
**********************************************************************
This e-mail and any attachments may contain confidential and
privileged information. If you are not the intended recipient,
please
notify the sender immediately by return e-mail, delete this e-mail
and
destroy any copies. Any dissemination or use of this information
by a
person other than the intended recipient is unauthorized and may
be
illegal.
**********************************************************************