Excel remove blank rows in Email

Nothnless

Board Regular
Joined
Apr 28, 2016
Messages
142
Hi Guys,

I'm setting up an email template using some VBA where the following in displayed in the email:

Range("B11").Value & " " & Range("C11").Value & vbCrLf & _
Range("B12").Value & " " & Range("C12").Value & vbCrLf & _
Range("B13").Value & " " & Range("C13").Value & vbCrLf & _
Range("B14").Value & " " & Range("C14").Value & vbCrLf & _

How can I make it so if cells B12 and B13 are blank then the data in the email will display like this:

Range("B11").Value & " " & Range("C11").Value & vbCrLf & _
Range("B14").Value & " " & Range("C14").Value & vbCrLf & _
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Maybe something like this
But it may not work if the rest of the code affects the IF statement

Code:
If Range("B12").Value = "" And Range("B13").Value = "" Then
    Range("B11").Value & " " & Range("C11").Value & vbCrLf & _
    Range("B14").Value & " " & Range("C14").Value & vbCrLf & _
else
    Range("B11").Value & " " & Range("C11").Value & vbCrLf & _
    Range("B12").Value & " " & Range("C12").Value & vbCrLf & _
    Range("B13").Value & " " & Range("C13").Value & vbCrLf & _
    Range("B14").Value & " " & Range("C14").Value & vbCrLf & _
end if
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top