Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

Macro To Select Table Based On If It Has Content

$
0
0

My problem is simple, but might sound complex. I currently have a spreadsheet with a pivot table that is updated everyday. There are 8 pivot tables. One (A-E), second one (G-K), third one (M-Q), fourth one (S-W), fifth one (Y-AC), sixth one (AE-AI), seventh one (AK-AO), and eigth one (AQ-AU). All tables start on the third row.

What I'm trying to do is to make a macro which will check if there is anything in the second colum's fourth cell (so for example B4...H4....N4, T4...and so on for all eight tables). If there is something there, I want it to copy that table from A3 till end (I kind of have the line of code for this but don't know how to update it for the second-eigth tables:

      ActiveSheet.Range("a3", ActiveSheet.Range("e3").End(xlDown)).Select

and then send that in an email (which I also have the code for:

   ' Show the envelope on the ActiveWorkbook.
   ActiveWorkbook.EnvelopeVisible = True
  
   ' Set the optional introduction field thats adds
   ' some header text to the email body. It also sets
   ' the To and Subject lines. Finally the message
   ' is sent.
   With ActiveSheet.MailEnvelope
      .Introduction = "This is a sample worksheet."
      .Item.To = "Email here"
      .Item.Subject = "Subject head"
      .Item.Send

As a whole that is all I have at the moment. Please advise and help me solve this problem.


Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>