Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding space to formula in VBA

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
I have an excel spreadsheet that takes raw data transferred from a Delphi project and does some calculations before printing a report. One of the processes deletes the raw data rows that meet certain specifications. Unfortunately, when the first row of data is deleted from the raw data, the formula's on the report page lose the reference. So I decided to add a sub to run after the DeleteRows that enters the correct formula in the cells.

The formula I need to enter is:

Range(B2).Formula = "Data!A2&CHAR(10)&" "&Data!B2&CHAR(10)&" "&Data!C2"

However I get an error on the " in the middle of the string. How do I structure this so that I keep my spaces?

Thanks,

Leslie
 
I got it, just replace the " with '!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top