and some other stuff…

How To Cook Dog

Archives Posts

Delete Row Containing A Word In Excel

March 12th, 2008 by Dee

In the same data set I was working with last week of 1 Million Lines/Records. I needed to delete every row that contained the word PointA. Here is a simple VB Excel Macro that will delete every row containing “PointA” in column A. It could easily be adjusted for any need to delete a row in excel containing a specific word.


 
Sub DeleteRowsCcntainingWord()
    Dim c As Range
    Dim SrchRng
    
    Set SrchRng = ActiveSheet.Range("A1", ActiveSheet.Range("A65536").End(xlUp))
    Do
        Set c = SrchRng.Find("PointA", LookIn:=xlValues)
        If Not c Is Nothing Then c.EntireRow.Delete
     Loop While Not c Is Nothing
End Sub
 
Filed under programming having No Comments »

Archives Posts

Delete Every Other Row In Excel

March 10th, 2008 by Dee

I had over 1 Million GPS Coordinates That I needed to turn In 50 thousand. Here is a simple macro that you can use to dwindle down thoes records. This macro will only delete every other row so I had to run it quite a few times, but does the trick! It takes quite a while over 50000 records to grab a good soda and sit back.


 
Sub everyotherrow()
For i = 50000 To 2 Step -2
   Rows(i).Delete
Next i
End Sub
 
Filed under programming having No Comments »

Archives Posts

Equal Column Height, Based On/Not Equal Columns

March 3rd, 2008 by Dee

Alot of people have asked me how I got the equal columns on various versions of Integrity Baptist Church. For equal columns I use the following JavaScript


 
window.onload=function()
{
     if(document.getElementsByTagName)
   {
          matchColumns();      
     }
}
 
matchColumns=function()
{
     var divs,contDivs,maxHeight,divHeight,d;
     divs=document.getElementsByTagName('div');
     contDivs=[];
     maxHeight=0;
     for(var i=0;i<divs.length;i++)
   {
          if(/\bcolumn\b/.test(divs[i].className))
      {
                d=divs[i];
                contDivs[contDivs.length]=d;
                if(d.offsetHeight)
        {
                     divHeight=d.offsetHeight;          
                } else if(d.style.pixelHeight)
        {
                     divHeight=d.style.pixelHeight;          
                }
                maxHeight=Math.max(maxHeight,divHeight);
          }
     }
     for(var i=0;i<contDivs.length;i++)
   {
          contDivs[i].style.height=maxHeight + "px";
     }
}
 

On anthing where the heights arn’t equal and they need to be varied you can use this and just switch and swap numbers and signs:


 
window.onload = function()
{
  if (document.getElementsByTagName)
  {
    matchColumns();      
  }
}
 
matchColumns=function()
{  
  var leftheight = document.getElementById('welcome').offsetHeight;
  var rightheight = document.getElementById('rightcolumn').offsetHeight;
  
  if (rightheight < leftheight) //166 is based on the addition etc of everything.…
  {
    var newrightheight = leftheight - 10 ;
    document.getElementById('rightcolumn').style.height = newrightheight + 'px';
  }
  else if (leftheight < rightheight)
  {
    var newleftheight = rightheight - 10;
    document.getElementById('welcome').style.height = newleftheight + 'px';
  }
  //alert("Testing" + leftheight + " " + rightheight);
}
 
Filed under programming having No Comments »