PC Review


Reply
Thread Tools Rate Thread

Automation of Keystrokes in Populated Cells.

 
 
Aldini
Guest
Posts: n/a
 
      16th Oct 2008
I am seeking a way, using an Excel macro, to automatically edit a collection
of cells in the following way.
{F2} {Home} " ' " {Enter}
Of course if there is a better way, I would be happy to learn that also.
The issue is that I repeatedly copy data from a website data page, and paste
it into an Excel 2000 spreadsheet. One of the collumns of data needs to be
handled as text, but the characters are: nn-nnn/nn
where "n" is a number. When Excel in any way processes the characters as
numbers, then the cell ceases to be informative of the intended label.
Thanks
 
Reply With Quote
 
 
 
 
Barb Reinhardt
Guest
Posts: n/a
 
      16th Oct 2008
You could select the cells and run this macro.

Sub Test
dim myRange as range
Dim r as range

set myRange = Selection

for each r in myrange
r.value = "'" & r.text
next r

End sub
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Aldini" wrote:

> I am seeking a way, using an Excel macro, to automatically edit a collection
> of cells in the following way.
> {F2} {Home} " ' " {Enter}
> Of course if there is a better way, I would be happy to learn that also.
> The issue is that I repeatedly copy data from a website data page, and paste
> it into an Excel 2000 spreadsheet. One of the collumns of data needs to be
> handled as text, but the characters are: nn-nnn/nn
> where "n" is a number. When Excel in any way processes the characters as
> numbers, then the cell ceases to be informative of the intended label.
> Thanks

 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      16th Oct 2008
You can do it with code like

Sub AAA()
Dim R As Range
If TypeOf Selection Is Excel.Range Then
For Each R In Selection.Cells
If R.HasFormula = False Then
If R.PrefixCharacter = vbNullString Then
R.Value = "'" & R.Value
End If
End If
Next R
End If
End Sub

Select the cell(s) to modify and run the code.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 16 Oct 2008 09:45:01 -0700, Aldini
<(E-Mail Removed)> wrote:

>I am seeking a way, using an Excel macro, to automatically edit a collection
>of cells in the following way.
>{F2} {Home} " ' " {Enter}
>Of course if there is a better way, I would be happy to learn that also.
>The issue is that I repeatedly copy data from a website data page, and paste
>it into an Excel 2000 spreadsheet. One of the collumns of data needs to be
>handled as text, but the characters are: nn-nnn/nn
> where "n" is a number. When Excel in any way processes the characters as
>numbers, then the cell ceases to be informative of the intended label.
>Thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Averaging only populated cells John Microsoft Excel Worksheet Functions 6 19th Sep 2009 02:57 PM
how do populate empty cells with the contents of populated cells . =?Utf-8?B?SmltOTk=?= Microsoft Excel Misc 6 21st Apr 2005 05:44 PM
select populated cells Kevin Microsoft Excel Programming 1 23rd Sep 2004 07:52 PM
Populated cells Al Microsoft Excel Programming 2 24th May 2004 03:39 PM
Requiring Cells be Populated Phil Hageman Microsoft Excel Programming 7 10th Jan 2004 07:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:45 PM.