Excel: Insert multiple rows every other row

12 03 2012

The key is to use a macro.  To do so, hit Alt+F11, then create a new macro and add the code below. Once added, select the worksheet you’d like to process, change the “17” below (1 if to process all rows), then run it.

That’s it.

Sub Insert_Blank_Rows()

    Dim Last As Integer, oRow As Integer
    ‘Count and select rows to process
    Last = Range("A" & Rows.Count).End(xlUp).row
   
    ’17 is the last row to process (at the top)
    For oRow = Last To 17 Step -1
     If Not Cells(oRow, 1).Value = "" Then
        ‘Copy the line below to as many row insert you need
        ‘in this case, it was 3 row inserts
        Cells(oRow, 1).EntireRow.Insert
        Cells(oRow, 1).EntireRow.Insert
        Cells(oRow, 1).EntireRow.Insert
       End If
    Next oRow

End Sub
   



PowerShell: Deleting entire lines in a text file based on a partial string match

11 07 2011

PS C:\workspace> (gc “fileToParse.txt”) -notmatch "<criteria>" | out-file
"resultFile.txt"

Note: <Criteria>, for example, “not".



PowerShell: Rename file to lowercase

15 06 2011

1. Open PowerShell

2. CD into directory to work on

3. Execute the following command:

get-childitem * -recurse | rename-item -newname { $_.name.ToLower() }



PowerShell: Rename file’s file extension

15 06 2011

1. Open PowerShell

2. CD into directory to work on

3. Execute the following command:

get-childitem * -recurse | rename-item -newname { $_.name -replace ".txt",".bcp" }



Read a file with bash

16 08 2007

I had to test our download servers at work right away, i.e., HTTP vs HTTPS, which required downloading a large number of files.  A file list was given to me to work with, like so:

/download/integrations/file1.exe
/download/us/update/patch/file1.exe
/download/us/cab/file1.exe

So I decided to use the bash shell to read each line and run wget quick and dirty.  Here’s the script:

cat c:\\test.txt | while read line; do wget “URL/${line}”; done

While running it I just used the Windows clock to get an approximate time difference.

That’s it!  Hope this helps.