naming a range but i dont want it to gotoend of formula

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,227
Office Version
  1. 2010
Platform
  1. Windows
Hi Hope you can help and that this makes sense :)

Below is a snippet of code i am using for an email, what this code does is copy information in my work issue sheet and copies over into the email. But in my work issue sheet in columns N to V i have formulas that go all the way down for example to column 32, but this is not always filled with data found, for example it might only find data down to column 5, but the formula will still be below. I only want the below code to only copy the data found and not the blank cells with the formula as well. Is this possible and i hope you can help :) :)

Code:
LastRow = Sheets("Work Issue").Columns("N:V").Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
Set rngDataToEmail = Sheets("Work Issue").Range("N1:V" & LastRow)
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
So you have formulas that produce blank you mean? You should get used to using all the parameters that could influence the result of the Find. You need this added:

Code:
LookIn:=xlValues
 
Upvote 0
hi thank you for the reply yes when the cell doesnt find anything the formula is still there but it gets added to the email as a blank. where would i put the code in please?
 
Upvote 0
Your Find:

Code:
Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows)

Place it inside with the other parameters so it becomes:

Code:
Find(What:="*",LookIn:=xlValues, SearchDirection:=xlPrevious, SearchOrder:=xlByRows)
 
Upvote 0
thank you , is there any well to put in a border around the cells as well, for columns N to Z?
 
Upvote 0

Forum statistics

Threads
1,214,645
Messages
6,120,711
Members
448,984
Latest member
foxpro

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