automatically inserting after text

  • Thread starter Thread starter Q
  • Start date Start date
Q

Q

i have a given template in which there are spaces that i
insert information in excel using vba. is there a way
that i can have the inserts fill in after the last word of
text or do i have to put it into the next empty cell? for
example:

if i had the following sentence:
"..the estimate cost on ___________"

can i get the insert to fill in after the word "on" or do
i have to put it into the next empty cell. if anyone can
help me, i'll truely appreciate it; if you need more
clarification, just email me & thanks again in advance.

~q
 
You could use a UserForm with TextBoxes to input the information. So if
your UserForm has TextBox1 and the example you gave in your post was in cell
A1, you could have code in your UserForm that would insert the whole thing
into A1 such as:

Dim Str1$ as String

Str1 = "...the estimate cost on "
Range("A1").Value = Str1 & TextBox1.Value

Post back if you have any questions.

--
Michael J. Malinsky
Pittsburgh, PA

"I was gratified to be able to answer promptly,
and I did. I said I didn't know." -- Mark Twain
 
well its an already set template, and it's an automated
letter, so the example sentence is already there, and the
information, comes in as a data dump and they start the
macro and the macro automatically fills in the blank and
prints out a letter, line by line. i was just wondering
if you could put the insert after the text cause right now
there are some noticable gaps in the letter because of
where the columns start. so using it as a string may not
be possible. or maybe it is and i just don't know how to
use it. thanks in advance. but i will try changing the
text to strings, but while i'm doing that is there a way
to just have a piece of code insert it after the text as
is. thanks in advance.

~q
 
How about something like:

Range("A1").Value = Range("A1").Value & " " & _
Format(TextBox1.Value, "#,###")

This will take whatever is in A1 and add the value in textbox1 (formatted as
comma format, no decimals)


--
Michael J. Malinsky
Pittsburgh, PA

"I was gratified to be able to answer promptly,
and I did. I said I didn't know." -- Mark Twain
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top