Sorting data in a table by date

teekayy

New Member
Joined
Feb 7, 2012
Messages
32
Hi All,

I have macro which creates a table and attaches it to an email. Is it possible to rearrange this data so that the table is essentially split into 2 tables, where the first part of the table show only the data from yesterdays date (column b), and then below this data there is a line that says "Running total" and then the data from all the other dates.

Here is the code:

Rich (BB code):
      a = Range("a1:a200000")
      b = Range("b1:b200000")
      d = Range("d1:d200000")
      m = Range("m1:m200000")     
      f = Range("f1:f200000")
      g = Range("g1:g200000")
      
     jk = Range("j1:j200000")
      n = Range("n1:n200000")    
      
      count1 = 0

 ebody1 = "" + "" + "Deal Title" + ""
    
    For i = 2 To 200000
             
        If j(i) = 0 And a(i, 1) <> "" And CStr(f(i, 1)) <> "" Then
              
        count = 0
        count1 = 0
        count2 = 0

        For k = 2 To 200000
        

               If CStr(g(k, 1)) = CStr(g(i, 1)) And j(k) = 0 And a(k, 1) <> "" And CStr(f(i, 1)) <> "" Then
                             
               count = count + 1

                count2 = count2 + 1
                j(k) = 1
   
         ebody = CStr(n(k, 1)) + "" + ebody
       

                End If
         
           Next
         
       ebody = ebody1 + ebody + "
" + "Contract ID" + "" + "Refund Date" + "" + "Deal ID" + "" + "Voucher Code" + "
" + CStr(g(k, 1)) + "" + CStr(b(k, 1)) + "" + CStr(m(k, 1)) + "" + CStr(jk(k, 1)) + "
<tbody> </tbody>
"

Is this at all possible?

Thanks!

Tee
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Can anyone assist? I was thinking if it is too complicated to do, maybe it is possible to highlight the rows in the table where the date (column b) is equal to yesterdays date?
 
Upvote 0
You shoulf have open your own thread but:
Excel 03 formula<code>
=TODAY()-A1=1</code>
where A1 is the date of intrest then copy the format down.
In Excle 07/10 go to Conditional Formatting-->Higlight Cell Rules-->A Date Accuring...

Sheet2


*A
3*
418/06/2012
518/06/2012
6*
7*
8*
920/06/2012
10*
11*
12*
13*
14*
15*
16*
17*
1818/06/2012

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:75px;"></colgroup><tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0

Forum statistics

Threads
1,214,386
Messages
6,119,214
Members
448,874
Latest member
b1step2far

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