If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
function needed
Hi,
is there a function in VBA that can do following: I want to specify string X, char A , and length N of resultant string. Function should fill string X from left with char A so resultant string would be N long. eg. F('abc','x', 6) = 'xxxabc' Thanx alekmil |
#2
|
|||
|
|||
This is similar to the older LPad function which was part of the
NeatCode.mdb distributed years ago for Access 2.0: Function LeftFill(strIn As String, ByVal strChr As String, intCount As Integer) As String ' Adds a character (strChr) to the left of strIn to make it right justified ' by intCount characters On Error Resume Next If Len(strChr) = 0 Then strChr = " " If intCount 1 Then LeftFill = "" Else LeftFill = Right(String(intCount, Left(strChr, 1)) & strIn, intCount) End If End Function -- Arvin Meyer, MCP, MVP Microsoft Access Free Access downloads: http://www.datastrat.com http://www.mvps.org/access "alekm" wrote in message ... Hi, is there a function in VBA that can do following: I want to specify string X, char A , and length N of resultant string. Function should fill string X from left with char A so resultant string would be N long. eg. F('abc','x', 6) = 'xxxabc' Thanx alekmil |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help needed with Function | Yogi Watcher | General Discussion | 2 | July 8th, 2004 07:13 PM |
Excel Function help needed please! | CRWJumper | Worksheet Functions | 2 | March 11th, 2004 12:50 PM |
My own function cannot be exported. | Christian | Worksheet Functions | 0 | November 26th, 2003 03:22 PM |
Keeping a Function Cell Blank Until It's Needed | barry a | Worksheet Functions | 1 | September 26th, 2003 06:41 PM |