How to Delete Returns in Excel

The pesky carraige return and new line characters, while providing a way to present text for human viewing, are not always desirable when working in a spreadsheet program like Microsoft Excel or OpenOffice.org.

In Excel, a bit of code provided by Ivan Moala on mrexcel.com, works wonders. Here is the code:


'Created by Chip Pearson
'Cleans up data by removing tabs and carriage returns in worksheet cells.
Sub CleanUp()
Dim TheCell As Range
For Each TheCell In ActiveSheet.UsedRange
With TheCell
If .HasFormula = False Then
.Value = Application.WorksheetFunction.Clean(.Value)
End If
End With
Next TheCell
End Sub

Here’s how to use it:

  • In Excel click Tools > Macro > Visual Basic Editor (or just hit Alt-F11)
  • In the top-left pane under the Project heading, double-click the name of the sheet you want to strip all the newlines and carriage returns from.
  • In the window that pops up, paste the code above into the empty box under where you see General and Declarations.
  • Run the macro by clicking the “play” button above, or hit F5

Warning: make a backup copy of your Excel workbook before performing the above procedure.

Posted under Excel, Microsoft, Uncategorized

Alternate Time Servers for Automatic Clock Set

In modern Microsoft Windows operating systems and all Unix / Linux systems the system clock time can be set automatically. The computer will connect to a special server on the Internet called a Network Time Protocol server, and get the current universal time, and then adjust it according to the local time zone on the computer. It keeps the computer clock very accurate and corrects drift before it can become much of a problem.

We recommend using a reliable server: pool.ntp.org

A wonderful group of generous folks provide this extremely reliable cluster of computers for us all to use, free of charge. Thank you NTP Pool Project and all the participants!

Posted under Freeware, Linux, WebDev

How to CHMOD on files but not directories (inodes)

From Linuxquestions.org:

“There are probably several methods, but one is to use find to produce a list of all files (not directories) and then execute chmod on each of them. For example

Code:
find /my/directory -type f -exec chmod 644 '{}' +

Change the red parts to fit your needs. If you wonder what that ‘{}’ is..well, you may have guessed that it’s where the filelist is being put when exec’ing the given command on each file.

You can also first try the command without chmod’ing to see that it affects the right files:

Code:
find /my/directory -type f

The above would find all regular files (not directories, for example) from within /my/directory.

If the command happens to throw you an error about the exec part, chances are it’s because of the plus sign (+) that ends the exec part. In this case try replacing the plus (+) with an escaped semicolon (\;) so it becomes

Code:
find /my/directory -type f -exec chmod 644 '{}' \;

On some machines I remember that it worked with semicolon (which needs a backslash in front of it, to protect it from being interpreted by your shell), but on my current installation it’s the plus sign (without a backslash).

Another way would probably be to list all regular files on the directory (using either find or any tool that can just list all files without directories) and then pipe the output to xargs with which the chmod was run.”

and from http://movabletripe.com/archive/recursively-chmod-directories-only/

June 19th, 2006

find . -type d -exec chmod 755 {} \;

This will recursively search your directory tree (starting at dir ‘dot’) and chmod 755 all directories only.

Similarly, the following will chmod all files only (and ignore the directories):

find . -type f -exec chmod 644 {} \;

Posted under Linux

This post was written by Content Curator on October 17, 2009

Tags: , , , , , , , , , , , , , , , ,