PC Review


Reply
 
 
santaviga
Guest
Posts: n/a
 
      17th Jan 2008
Hi to all.

I need some help with exporting excel data to text file, I have data in
cells, I have a code for only returning max of 12 characters, this is fine
and working, but the cells that have below 12 characters I need these cells
to padded out with spaces so that when I export to a text file it looks like
columns in the text file.

Can anyone help me with this

Regards
 
Reply With Quote
 
 
 
 
Lazzzx
Guest
Posts: n/a
 
      17th Jan 2008
myString = Left(myString & Space(12), 12)

"santaviga" <(E-Mail Removed)> skrev i meddelelsen
news:76D2333F-7B72-4ACD-8D43-(E-Mail Removed)...
> Hi to all.
>
> I need some help with exporting excel data to text file, I have data in
> cells, I have a code for only returning max of 12 characters, this is fine
> and working, but the cells that have below 12 characters I need these
> cells
> to padded out with spaces so that when I export to a text file it looks
> like
> columns in the text file.
>
> Can anyone help me with this
>
> Regards


 
Reply With Quote
 
santaviga
Guest
Posts: n/a
 
      17th Jan 2008
How do I input this into a cell to operate???

Thanks

"Lazzzx" wrote:

> myString = Left(myString & Space(12), 12)
>
> "santaviga" <(E-Mail Removed)> skrev i meddelelsen
> news:76D2333F-7B72-4ACD-8D43-(E-Mail Removed)...
> > Hi to all.
> >
> > I need some help with exporting excel data to text file, I have data in
> > cells, I have a code for only returning max of 12 characters, this is fine
> > and working, but the cells that have below 12 characters I need these
> > cells
> > to padded out with spaces so that when I export to a text file it looks
> > like
> > columns in the text file.
> >
> > Can anyone help me with this
> >
> > Regards

>
>

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      17th Jan 2008
In the macro code (you are using a macro, right?) that is now returning your
max of 12 characters, replace whatever is doing the truncating (it should be
using the Left function) with the code line Lazzzx gave you (substituting
the variable name or cell value reference used in your current formula for
the myString example variable Lazzzx gave you; assigning it to whatever
variable you are currently assigning it to).

Usually if you are going to refer to code (or a formula on the spreadsheet
side of things), it is a good idea to post that code (or formula) rather
than make an off-hand reference to it; that way, we can post the
modification to it instead of giving a general example for you to try and
implement.

Rick


"santaviga" <(E-Mail Removed)> wrote in message
news:5231C89F-D3F4-4997-A65D-(E-Mail Removed)...
> How do I input this into a cell to operate???
>
> Thanks
>
> "Lazzzx" wrote:
>
>> myString = Left(myString & Space(12), 12)
>>
>> "santaviga" <(E-Mail Removed)> skrev i meddelelsen
>> news:76D2333F-7B72-4ACD-8D43-(E-Mail Removed)...
>> > Hi to all.
>> >
>> > I need some help with exporting excel data to text file, I have data in
>> > cells, I have a code for only returning max of 12 characters, this is
>> > fine
>> > and working, but the cells that have below 12 characters I need these
>> > cells
>> > to padded out with spaces so that when I export to a text file it looks
>> > like
>> > columns in the text file.
>> >
>> > Can anyone help me with this
>> >
>> > Regards

>>
>>


 
Reply With Quote
 
santaviga
Guest
Posts: n/a
 
      17th Jan 2008
I am not using a macro, my company doesn't allow them, is there any other way
to do this??

"Rick Rothstein (MVP - VB)" wrote:

> In the macro code (you are using a macro, right?) that is now returning your
> max of 12 characters, replace whatever is doing the truncating (it should be
> using the Left function) with the code line Lazzzx gave you (substituting
> the variable name or cell value reference used in your current formula for
> the myString example variable Lazzzx gave you; assigning it to whatever
> variable you are currently assigning it to).
>
> Usually if you are going to refer to code (or a formula on the spreadsheet
> side of things), it is a good idea to post that code (or formula) rather
> than make an off-hand reference to it; that way, we can post the
> modification to it instead of giving a general example for you to try and
> implement.
>
> Rick
>
>
> "santaviga" <(E-Mail Removed)> wrote in message
> news:5231C89F-D3F4-4997-A65D-(E-Mail Removed)...
> > How do I input this into a cell to operate???
> >
> > Thanks
> >
> > "Lazzzx" wrote:
> >
> >> myString = Left(myString & Space(12), 12)
> >>
> >> "santaviga" <(E-Mail Removed)> skrev i meddelelsen
> >> news:76D2333F-7B72-4ACD-8D43-(E-Mail Removed)...
> >> > Hi to all.
> >> >
> >> > I need some help with exporting excel data to text file, I have data in
> >> > cells, I have a code for only returning max of 12 characters, this is
> >> > fine
> >> > and working, but the cells that have below 12 characters I need these
> >> > cells
> >> > to padded out with spaces so that when I export to a text file it looks
> >> > like
> >> > columns in the text file.
> >> >
> >> > Can anyone help me with this
> >> >
> >> > Regards
> >>
> >>

>
>

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      17th Jan 2008
I figured you were using a macro because you said you have "code" (a
formula, assuming that is what you meant, is not code) and you posted your
question in a programming newsgroup. Anyway, referencing my last paragraph
for emphasis... how are you now returning your maximum of 12 characters
(that is, what is the "code" or formula being used)?

Rick


"santaviga" <(E-Mail Removed)> wrote in message
news:7F6CA61C-606A-4651-BCC6-(E-Mail Removed)...
>I am not using a macro, my company doesn't allow them, is there any other
>way
> to do this??
>
> "Rick Rothstein (MVP - VB)" wrote:
>
>> In the macro code (you are using a macro, right?) that is now returning
>> your
>> max of 12 characters, replace whatever is doing the truncating (it should
>> be
>> using the Left function) with the code line Lazzzx gave you (substituting
>> the variable name or cell value reference used in your current formula
>> for
>> the myString example variable Lazzzx gave you; assigning it to whatever
>> variable you are currently assigning it to).
>>
>> Usually if you are going to refer to code (or a formula on the
>> spreadsheet
>> side of things), it is a good idea to post that code (or formula) rather
>> than make an off-hand reference to it; that way, we can post the
>> modification to it instead of giving a general example for you to try and
>> implement.
>>
>> Rick
>>
>>
>> "santaviga" <(E-Mail Removed)> wrote in message
>> news:5231C89F-D3F4-4997-A65D-(E-Mail Removed)...
>> > How do I input this into a cell to operate???
>> >
>> > Thanks
>> >
>> > "Lazzzx" wrote:
>> >
>> >> myString = Left(myString & Space(12), 12)
>> >>
>> >> "santaviga" <(E-Mail Removed)> skrev i meddelelsen
>> >> news:76D2333F-7B72-4ACD-8D43-(E-Mail Removed)...
>> >> > Hi to all.
>> >> >
>> >> > I need some help with exporting excel data to text file, I have data
>> >> > in
>> >> > cells, I have a code for only returning max of 12 characters, this
>> >> > is
>> >> > fine
>> >> > and working, but the cells that have below 12 characters I need
>> >> > these
>> >> > cells
>> >> > to padded out with spaces so that when I export to a text file it
>> >> > looks
>> >> > like
>> >> > columns in the text file.
>> >> >
>> >> > Can anyone help me with this
>> >> >
>> >> > Regards
>> >>
>> >>

>>
>>


 
Reply With Quote
 
santaviga
Guest
Posts: n/a
 
      17th Jan 2008
Hi Rick,

Sorry for the misunderstanding. The formula i'm using is the following:

=LEFT(Sheet1!A1,12)

This returns the text in that cell to a max of 12, but I need this to pan
out to 12 characters if this cell only contains 5 characters so it will be
placed in a text file as if in colums.

Regards

"Rick Rothstein (MVP - VB)" wrote:

> I figured you were using a macro because you said you have "code" (a
> formula, assuming that is what you meant, is not code) and you posted your
> question in a programming newsgroup. Anyway, referencing my last paragraph
> for emphasis... how are you now returning your maximum of 12 characters
> (that is, what is the "code" or formula being used)?
>
> Rick
>
>
> "santaviga" <(E-Mail Removed)> wrote in message
> news:7F6CA61C-606A-4651-BCC6-(E-Mail Removed)...
> >I am not using a macro, my company doesn't allow them, is there any other
> >way
> > to do this??
> >
> > "Rick Rothstein (MVP - VB)" wrote:
> >
> >> In the macro code (you are using a macro, right?) that is now returning
> >> your
> >> max of 12 characters, replace whatever is doing the truncating (it should
> >> be
> >> using the Left function) with the code line Lazzzx gave you (substituting
> >> the variable name or cell value reference used in your current formula
> >> for
> >> the myString example variable Lazzzx gave you; assigning it to whatever
> >> variable you are currently assigning it to).
> >>
> >> Usually if you are going to refer to code (or a formula on the
> >> spreadsheet
> >> side of things), it is a good idea to post that code (or formula) rather
> >> than make an off-hand reference to it; that way, we can post the
> >> modification to it instead of giving a general example for you to try and
> >> implement.
> >>
> >> Rick
> >>
> >>
> >> "santaviga" <(E-Mail Removed)> wrote in message
> >> news:5231C89F-D3F4-4997-A65D-(E-Mail Removed)...
> >> > How do I input this into a cell to operate???
> >> >
> >> > Thanks
> >> >
> >> > "Lazzzx" wrote:
> >> >
> >> >> myString = Left(myString & Space(12), 12)
> >> >>
> >> >> "santaviga" <(E-Mail Removed)> skrev i meddelelsen
> >> >> news:76D2333F-7B72-4ACD-8D43-(E-Mail Removed)...
> >> >> > Hi to all.
> >> >> >
> >> >> > I need some help with exporting excel data to text file, I have data
> >> >> > in
> >> >> > cells, I have a code for only returning max of 12 characters, this
> >> >> > is
> >> >> > fine
> >> >> > and working, but the cells that have below 12 characters I need
> >> >> > these
> >> >> > cells
> >> >> > to padded out with spaces so that when I export to a text file it
> >> >> > looks
> >> >> > like
> >> >> > columns in the text file.
> >> >> >
> >> >> > Can anyone help me with this
> >> >> >
> >> >> > Regards
> >> >>
> >> >>
> >>
> >>

>
>

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      17th Jan 2008
Assuming you want the padding on the right, try using this instead...

=LEFT(A1&REPT(" ",12),12)

If you want the padding on the left (as maybe for numbers), then you would
use this formula...

=RIGHT(REPT(" ",12)&A1,12)

Rick


"santaviga" <(E-Mail Removed)> wrote in message
news:1DFFBF73-1636-4DAD-992B-(E-Mail Removed)...
> Hi Rick,
>
> Sorry for the misunderstanding. The formula i'm using is the following:
>
> =LEFT(Sheet1!A1,12)
>
> This returns the text in that cell to a max of 12, but I need this to pan
> out to 12 characters if this cell only contains 5 characters so it will be
> placed in a text file as if in colums.
>
> Regards
>
> "Rick Rothstein (MVP - VB)" wrote:
>
>> I figured you were using a macro because you said you have "code" (a
>> formula, assuming that is what you meant, is not code) and you posted
>> your
>> question in a programming newsgroup. Anyway, referencing my last
>> paragraph
>> for emphasis... how are you now returning your maximum of 12 characters
>> (that is, what is the "code" or formula being used)?
>>
>> Rick
>>
>>
>> "santaviga" <(E-Mail Removed)> wrote in message
>> news:7F6CA61C-606A-4651-BCC6-(E-Mail Removed)...
>> >I am not using a macro, my company doesn't allow them, is there any
>> >other
>> >way
>> > to do this??
>> >
>> > "Rick Rothstein (MVP - VB)" wrote:
>> >
>> >> In the macro code (you are using a macro, right?) that is now
>> >> returning
>> >> your
>> >> max of 12 characters, replace whatever is doing the truncating (it
>> >> should
>> >> be
>> >> using the Left function) with the code line Lazzzx gave you
>> >> (substituting
>> >> the variable name or cell value reference used in your current formula
>> >> for
>> >> the myString example variable Lazzzx gave you; assigning it to
>> >> whatever
>> >> variable you are currently assigning it to).
>> >>
>> >> Usually if you are going to refer to code (or a formula on the
>> >> spreadsheet
>> >> side of things), it is a good idea to post that code (or formula)
>> >> rather
>> >> than make an off-hand reference to it; that way, we can post the
>> >> modification to it instead of giving a general example for you to try
>> >> and
>> >> implement.
>> >>
>> >> Rick
>> >>
>> >>
>> >> "santaviga" <(E-Mail Removed)> wrote in message
>> >> news:5231C89F-D3F4-4997-A65D-(E-Mail Removed)...
>> >> > How do I input this into a cell to operate???
>> >> >
>> >> > Thanks
>> >> >
>> >> > "Lazzzx" wrote:
>> >> >
>> >> >> myString = Left(myString & Space(12), 12)
>> >> >>
>> >> >> "santaviga" <(E-Mail Removed)> skrev i
>> >> >> meddelelsen
>> >> >> news:76D2333F-7B72-4ACD-8D43-(E-Mail Removed)...
>> >> >> > Hi to all.
>> >> >> >
>> >> >> > I need some help with exporting excel data to text file, I have
>> >> >> > data
>> >> >> > in
>> >> >> > cells, I have a code for only returning max of 12 characters,
>> >> >> > this
>> >> >> > is
>> >> >> > fine
>> >> >> > and working, but the cells that have below 12 characters I need
>> >> >> > these
>> >> >> > cells
>> >> >> > to padded out with spaces so that when I export to a text file it
>> >> >> > looks
>> >> >> > like
>> >> >> > columns in the text file.
>> >> >> >
>> >> >> > Can anyone help me with this
>> >> >> >
>> >> >> > Regards
>> >> >>
>> >> >>
>> >>
>> >>

>>
>>


 
Reply With Quote
 
santaviga
Guest
Posts: n/a
 
      17th Jan 2008
thanks a lot Rick, works a treat.

Regards

"Rick Rothstein (MVP - VB)" wrote:

> Assuming you want the padding on the right, try using this instead...
>
> =LEFT(A1&REPT(" ",12),12)
>
> If you want the padding on the left (as maybe for numbers), then you would
> use this formula...
>
> =RIGHT(REPT(" ",12)&A1,12)
>
> Rick
>
>
> "santaviga" <(E-Mail Removed)> wrote in message
> news:1DFFBF73-1636-4DAD-992B-(E-Mail Removed)...
> > Hi Rick,
> >
> > Sorry for the misunderstanding. The formula i'm using is the following:
> >
> > =LEFT(Sheet1!A1,12)
> >
> > This returns the text in that cell to a max of 12, but I need this to pan
> > out to 12 characters if this cell only contains 5 characters so it will be
> > placed in a text file as if in colums.
> >
> > Regards
> >
> > "Rick Rothstein (MVP - VB)" wrote:
> >
> >> I figured you were using a macro because you said you have "code" (a
> >> formula, assuming that is what you meant, is not code) and you posted
> >> your
> >> question in a programming newsgroup. Anyway, referencing my last
> >> paragraph
> >> for emphasis... how are you now returning your maximum of 12 characters
> >> (that is, what is the "code" or formula being used)?
> >>
> >> Rick
> >>
> >>
> >> "santaviga" <(E-Mail Removed)> wrote in message
> >> news:7F6CA61C-606A-4651-BCC6-(E-Mail Removed)...
> >> >I am not using a macro, my company doesn't allow them, is there any
> >> >other
> >> >way
> >> > to do this??
> >> >
> >> > "Rick Rothstein (MVP - VB)" wrote:
> >> >
> >> >> In the macro code (you are using a macro, right?) that is now
> >> >> returning
> >> >> your
> >> >> max of 12 characters, replace whatever is doing the truncating (it
> >> >> should
> >> >> be
> >> >> using the Left function) with the code line Lazzzx gave you
> >> >> (substituting
> >> >> the variable name or cell value reference used in your current formula
> >> >> for
> >> >> the myString example variable Lazzzx gave you; assigning it to
> >> >> whatever
> >> >> variable you are currently assigning it to).
> >> >>
> >> >> Usually if you are going to refer to code (or a formula on the
> >> >> spreadsheet
> >> >> side of things), it is a good idea to post that code (or formula)
> >> >> rather
> >> >> than make an off-hand reference to it; that way, we can post the
> >> >> modification to it instead of giving a general example for you to try
> >> >> and
> >> >> implement.
> >> >>
> >> >> Rick
> >> >>
> >> >>
> >> >> "santaviga" <(E-Mail Removed)> wrote in message
> >> >> news:5231C89F-D3F4-4997-A65D-(E-Mail Removed)...
> >> >> > How do I input this into a cell to operate???
> >> >> >
> >> >> > Thanks
> >> >> >
> >> >> > "Lazzzx" wrote:
> >> >> >
> >> >> >> myString = Left(myString & Space(12), 12)
> >> >> >>
> >> >> >> "santaviga" <(E-Mail Removed)> skrev i
> >> >> >> meddelelsen
> >> >> >> news:76D2333F-7B72-4ACD-8D43-(E-Mail Removed)...
> >> >> >> > Hi to all.
> >> >> >> >
> >> >> >> > I need some help with exporting excel data to text file, I have
> >> >> >> > data
> >> >> >> > in
> >> >> >> > cells, I have a code for only returning max of 12 characters,
> >> >> >> > this
> >> >> >> > is
> >> >> >> > fine
> >> >> >> > and working, but the cells that have below 12 characters I need
> >> >> >> > these
> >> >> >> > cells
> >> >> >> > to padded out with spaces so that when I export to a text file it
> >> >> >> > looks
> >> >> >> > like
> >> >> >> > columns in the text file.
> >> >> >> >
> >> >> >> > Can anyone help me with this
> >> >> >> >
> >> >> >> > Regards
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >>
> >>

>
>

 
Reply With Quote
 
santaviga
Guest
Posts: n/a
 
      18th Jan 2008
Hi Rick,

If I were to put this into a macro so it will do what i require with that,
how would the code be written. Any ideas.

Regards

"Rick Rothstein (MVP - VB)" wrote:

> Assuming you want the padding on the right, try using this instead...
>
> =LEFT(A1&REPT(" ",12),12)
>
> If you want the padding on the left (as maybe for numbers), then you would
> use this formula...
>
> =RIGHT(REPT(" ",12)&A1,12)
>
> Rick
>
>
> "santaviga" <(E-Mail Removed)> wrote in message
> news:1DFFBF73-1636-4DAD-992B-(E-Mail Removed)...
> > Hi Rick,
> >
> > Sorry for the misunderstanding. The formula i'm using is the following:
> >
> > =LEFT(Sheet1!A1,12)
> >
> > This returns the text in that cell to a max of 12, but I need this to pan
> > out to 12 characters if this cell only contains 5 characters so it will be
> > placed in a text file as if in colums.
> >
> > Regards
> >
> > "Rick Rothstein (MVP - VB)" wrote:
> >
> >> I figured you were using a macro because you said you have "code" (a
> >> formula, assuming that is what you meant, is not code) and you posted
> >> your
> >> question in a programming newsgroup. Anyway, referencing my last
> >> paragraph
> >> for emphasis... how are you now returning your maximum of 12 characters
> >> (that is, what is the "code" or formula being used)?
> >>
> >> Rick
> >>
> >>
> >> "santaviga" <(E-Mail Removed)> wrote in message
> >> news:7F6CA61C-606A-4651-BCC6-(E-Mail Removed)...
> >> >I am not using a macro, my company doesn't allow them, is there any
> >> >other
> >> >way
> >> > to do this??
> >> >
> >> > "Rick Rothstein (MVP - VB)" wrote:
> >> >
> >> >> In the macro code (you are using a macro, right?) that is now
> >> >> returning
> >> >> your
> >> >> max of 12 characters, replace whatever is doing the truncating (it
> >> >> should
> >> >> be
> >> >> using the Left function) with the code line Lazzzx gave you
> >> >> (substituting
> >> >> the variable name or cell value reference used in your current formula
> >> >> for
> >> >> the myString example variable Lazzzx gave you; assigning it to
> >> >> whatever
> >> >> variable you are currently assigning it to).
> >> >>
> >> >> Usually if you are going to refer to code (or a formula on the
> >> >> spreadsheet
> >> >> side of things), it is a good idea to post that code (or formula)
> >> >> rather
> >> >> than make an off-hand reference to it; that way, we can post the
> >> >> modification to it instead of giving a general example for you to try
> >> >> and
> >> >> implement.
> >> >>
> >> >> Rick
> >> >>
> >> >>
> >> >> "santaviga" <(E-Mail Removed)> wrote in message
> >> >> news:5231C89F-D3F4-4997-A65D-(E-Mail Removed)...
> >> >> > How do I input this into a cell to operate???
> >> >> >
> >> >> > Thanks
> >> >> >
> >> >> > "Lazzzx" wrote:
> >> >> >
> >> >> >> myString = Left(myString & Space(12), 12)
> >> >> >>
> >> >> >> "santaviga" <(E-Mail Removed)> skrev i
> >> >> >> meddelelsen
> >> >> >> news:76D2333F-7B72-4ACD-8D43-(E-Mail Removed)...
> >> >> >> > Hi to all.
> >> >> >> >
> >> >> >> > I need some help with exporting excel data to text file, I have
> >> >> >> > data
> >> >> >> > in
> >> >> >> > cells, I have a code for only returning max of 12 characters,
> >> >> >> > this
> >> >> >> > is
> >> >> >> > fine
> >> >> >> > and working, but the cells that have below 12 characters I need
> >> >> >> > these
> >> >> >> > cells
> >> >> >> > to padded out with spaces so that when I export to a text file it
> >> >> >> > looks
> >> >> >> > like
> >> >> >> > columns in the text file.
> >> >> >> >
> >> >> >> > Can anyone help me with this
> >> >> >> >
> >> >> >> > Regards
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >>
> >>

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Making a MsgBox return cell data when search finds different data in an adjacent cell Don Guillett Microsoft Excel Discussion 0 4th Jul 2009 01:37 PM
converting numerical data in one cell to word data in another cell Vishnu Microsoft Excel Worksheet Functions 2 4th Jun 2008 03:14 PM
how to find number in a cell , a cell contains character data ornumeric data SSSundhar@gmail.com Microsoft Excel Worksheet Functions 3 19th Feb 2008 07:29 PM
Find MAX data in sheet (Cell) - Any cell that exceeds X amount of data confuzedagain Microsoft Excel Misc 1 7th Dec 2005 05:56 PM
data validation to restrict input in cell based on value of cell above that cell NC Microsoft Excel Programming 2 25th Jan 2005 07:11 AM


Features
 

Advertising
 

Newsgroups
 


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