PC Review


Reply
Thread Tools Rate Thread

Deselect a range?

 
 
StargateFan
Guest
Posts: n/a
 
      21st Jan 2007
This one has been asked many times before, I see from the archives.
But I can't get anything recommended to work.

Here is the code:
************************************************************************************
Sub SelectTextColumnA()
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
End Sub
************************************************************************************

If I select something else, as recommended, that doesn't get rid of
tghe marching ants.

If I set the cuut/copy mode to false, as also recommended, the text
isn't in the clipboard so it nullifies the code:
Application.CutCopyMode = False

In fact, any of the other recommendations tried do that. The text is
no longer in the clipboard so the whole macro doesn't work. Is there
a way to get the text into the clipboard yet de-select the range?

I've tried so much from the archives this morning and nothing works so
appreciate any help.

 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      21st Jan 2007
You didn't say where to copy to but try this ONE liner. Change to suit.

Sub copyTextColumnA()
Range("A2:a" & Cells(2, "a").End(xlDown).Row).Copy Range("i19")
End Sub

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"StargateFan" <IDon'tAcceptSpam@IDon'tAcceptSpam.com> wrote in message
news:(E-Mail Removed)...
> This one has been asked many times before, I see from the archives.
> But I can't get anything recommended to work.
>
> Here is the code:
> ************************************************************************************
> Sub SelectTextColumnA()
> Range("A2").Select
> Range(Selection, Selection.End(xlDown)).Select
> Selection.Copy
> End Sub
> ************************************************************************************
>
> If I select something else, as recommended, that doesn't get rid of
> tghe marching ants.
>
> If I set the cuut/copy mode to false, as also recommended, the text
> isn't in the clipboard so it nullifies the code:
> Application.CutCopyMode = False
>
> In fact, any of the other recommendations tried do that. The text is
> no longer in the clipboard so the whole macro doesn't work. Is there
> a way to get the text into the clipboard yet de-select the range?
>
> I've tried so much from the archives this morning and nothing works so
> appreciate any help.
>



 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      21st Jan 2007
It occurs to me that I did not answer your specific question.
application.cutcopymode=false

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Don Guillett" <(E-Mail Removed)> wrote in message
news:eTtBY%(E-Mail Removed)...
> You didn't say where to copy to but try this ONE liner. Change to suit.
>
> Sub copyTextColumnA()
> Range("A2:a" & Cells(2, "a").End(xlDown).Row).Copy Range("i19")
> End Sub
>
> --
> Don Guillett
> SalesAid Software
> (E-Mail Removed)
> "StargateFan" <IDon'tAcceptSpam@IDon'tAcceptSpam.com> wrote in message
> news:(E-Mail Removed)...
>> This one has been asked many times before, I see from the archives.
>> But I can't get anything recommended to work.
>>
>> Here is the code:
>> ************************************************************************************
>> Sub SelectTextColumnA()
>> Range("A2").Select
>> Range(Selection, Selection.End(xlDown)).Select
>> Selection.Copy
>> End Sub
>> ************************************************************************************
>>
>> If I select something else, as recommended, that doesn't get rid of
>> tghe marching ants.
>>
>> If I set the cuut/copy mode to false, as also recommended, the text
>> isn't in the clipboard so it nullifies the code:
>> Application.CutCopyMode = False
>>
>> In fact, any of the other recommendations tried do that. The text is
>> no longer in the clipboard so the whole macro doesn't work. Is there
>> a way to get the text into the clipboard yet de-select the range?
>>
>> I've tried so much from the archives this morning and nothing works so
>> appreciate any help.
>>

>
>



 
Reply With Quote
 
StargateFan
Guest
Posts: n/a
 
      21st Jan 2007
On Sun, 21 Jan 2007 09:27:48 -0600, "Don Guillett"
<(E-Mail Removed)> wrote:

>It occurs to me that I did not answer your specific question.
>application.cutcopymode=false


As mentioned, when I use that, nothing gets copied as it clears the
clipboard, so it's no good.

In order for the range to get de-selected, I put the above code in
this position shown below (right above "End Sub"), but it seems that
the clipbard gets cleared with this command, so it nullifies the
entire macro and so it doesn't work.
************************************************************************************
Sub SelectTextColumnA()
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Application.cutcopymode=false
End Sub
************************************************************************************




I would like the range to be copied to the clipboard but to then have
the selection de-selected.




This code here below also doesn't work:
************************************************************************************
Sub SelectTextColumnA()
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("B2").Select
Range("A2").Select
End Sub
************************************************************************************

The archives talked about selecting something else outside the range
(hence the "Range("B2").Select" above followed by the code to get back
to where I'd like cursor to go, "Range("A2").Select"). But again,
this doesn't work. There is nothing in the clipboard.

The original code, as shown below in the original message, does work.
It's just that the range remains selected, which is a pain.

Hope that's clearer. I guess I didn't explain well enough.

(p.s., I apologize for any apparent misspellings. I need to change my
keyboard. It's a little too sensitive lately. <g>)

Thanks!

>--
>Don Guillett
>SalesAid Software
>(E-Mail Removed)
>"Don Guillett" <(E-Mail Removed)> wrote in message
>news:eTtBY%(E-Mail Removed)...
>> You didn't say where to copy to but try this ONE liner. Change to suit.
>>
>> Sub copyTextColumnA()
>> Range("A2:a" & Cells(2, "a").End(xlDown).Row).Copy Range("i19")
>> End Sub
>>
>> --
>> Don Guillett
>> SalesAid Software
>> (E-Mail Removed)
>> "StargateFan" <IDon'tAcceptSpam@IDon'tAcceptSpam.com> wrote in message
>> news:(E-Mail Removed)...
>>> This one has been asked many times before, I see from the archives.
>>> But I can't get anything recommended to work.
>>>
>>> Here is the code:
>>> ************************************************************************************
>>> Sub SelectTextColumnA()
>>> Range("A2").Select
>>> Range(Selection, Selection.End(xlDown)).Select
>>> Selection.Copy
>>> End Sub
>>> ************************************************************************************
>>>
>>> If I select something else, as recommended, that doesn't get rid of
>>> tghe marching ants.
>>>
>>> If I set the cuut/copy mode to false, as also recommended, the text
>>> isn't in the clipboard so it nullifies the code:
>>> Application.CutCopyMode = False
>>>
>>> In fact, any of the other recommendations tried do that. The text is
>>> no longer in the clipboard so the whole macro doesn't work. Is there
>>> a way to get the text into the clipboard yet de-select the range?
>>>
>>> I've tried so much from the archives this morning and nothing works so
>>> appreciate any help.
>>>

>>
>>

>


 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      21st Jan 2007
As I said you MUST designate a place to copy TO. Again, I suggest you use my
ONE liner.

Sub SelectTextColumnA()
> Range("A2").Select
> Range(Selection, Selection.End(xlDown)).Select
> Selection.Copy


range("b3").paste

> Application.cutcopymode=false
> End Sub




--
Don Guillett
SalesAid Software
(E-Mail Removed)
"StargateFan" <IDon'tAcceptSpam@IDon'tAcceptSpam.com> wrote in message
news:(E-Mail Removed)...
> On Sun, 21 Jan 2007 09:27:48 -0600, "Don Guillett"
> <(E-Mail Removed)> wrote:
>
>>It occurs to me that I did not answer your specific question.
>>application.cutcopymode=false

>
> As mentioned, when I use that, nothing gets copied as it clears the
> clipboard, so it's no good.
>
> In order for the range to get de-selected, I put the above code in
> this position shown below (right above "End Sub"), but it seems that
> the clipbard gets cleared with this command, so it nullifies the
> entire macro and so it doesn't work.
> ************************************************************************************
> Sub SelectTextColumnA()
> Range("A2").Select
> Range(Selection, Selection.End(xlDown)).Select
> Selection.Copy
> Application.cutcopymode=false
> End Sub
> ************************************************************************************
>
>
>
>
> I would like the range to be copied to the clipboard but to then have
> the selection de-selected.
>
>
>
>
> This code here below also doesn't work:
> ************************************************************************************
> Sub SelectTextColumnA()
> Range("A2").Select
> Range(Selection, Selection.End(xlDown)).Select
> Selection.Copy
> Range("B2").Select
> Range("A2").Select
> End Sub
> ************************************************************************************
>
> The archives talked about selecting something else outside the range
> (hence the "Range("B2").Select" above followed by the code to get back
> to where I'd like cursor to go, "Range("A2").Select"). But again,
> this doesn't work. There is nothing in the clipboard.
>
> The original code, as shown below in the original message, does work.
> It's just that the range remains selected, which is a pain.
>
> Hope that's clearer. I guess I didn't explain well enough.
>
> (p.s., I apologize for any apparent misspellings. I need to change my
> keyboard. It's a little too sensitive lately. <g>)
>
> Thanks!
>
>>--
>>Don Guillett
>>SalesAid Software
>>(E-Mail Removed)
>>"Don Guillett" <(E-Mail Removed)> wrote in message
>>news:eTtBY%(E-Mail Removed)...
>>> You didn't say where to copy to but try this ONE liner. Change to suit.
>>>
>>> Sub copyTextColumnA()
>>> Range("A2:a" & Cells(2, "a").End(xlDown).Row).Copy Range("i19")
>>> End Sub
>>>
>>> --
>>> Don Guillett
>>> SalesAid Software
>>> (E-Mail Removed)
>>> "StargateFan" <IDon'tAcceptSpam@IDon'tAcceptSpam.com> wrote in message
>>> news:(E-Mail Removed)...
>>>> This one has been asked many times before, I see from the archives.
>>>> But I can't get anything recommended to work.
>>>>
>>>> Here is the code:
>>>> ************************************************************************************
>>>> Sub SelectTextColumnA()
>>>> Range("A2").Select
>>>> Range(Selection, Selection.End(xlDown)).Select
>>>> Selection.Copy
>>>> End Sub
>>>> ************************************************************************************
>>>>
>>>> If I select something else, as recommended, that doesn't get rid of
>>>> tghe marching ants.
>>>>
>>>> If I set the cuut/copy mode to false, as also recommended, the text
>>>> isn't in the clipboard so it nullifies the code:
>>>> Application.CutCopyMode = False
>>>>
>>>> In fact, any of the other recommendations tried do that. The text is
>>>> no longer in the clipboard so the whole macro doesn't work. Is there
>>>> a way to get the text into the clipboard yet de-select the range?
>>>>
>>>> I've tried so much from the archives this morning and nothing works so
>>>> appreciate any help.
>>>>
>>>
>>>

>>

>



 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      21st Jan 2007
Fan

You have to do something with the selection before clearing the clipboard

Similar to.............without all the "select" statements

Sub SelectTextColumnA()
Range(Range("A2"), Range("A2").End(xlDown)).Copy _
Destination:=Sheets("Sheet2").Range("A1")
Application.CutCopyMode = False
End Sub


Gord Dibben MS Excel MVP


On Sun, 21 Jan 2007 11:02:14 -0500, StargateFan
<IDon'tAcceptSpam@IDon'tAcceptSpam.com> wrote:

>On Sun, 21 Jan 2007 09:27:48 -0600, "Don Guillett"
><(E-Mail Removed)> wrote:
>
>>It occurs to me that I did not answer your specific question.
>>application.cutcopymode=false

>
>As mentioned, when I use that, nothing gets copied as it clears the
>clipboard, so it's no good.
>
>In order for the range to get de-selected, I put the above code in
>this position shown below (right above "End Sub"), but it seems that
>the clipbard gets cleared with this command, so it nullifies the
>entire macro and so it doesn't work.
>************************************************************************************
>Sub SelectTextColumnA()
>Range("A2").Select
>Range(Selection, Selection.End(xlDown)).Select
>Selection.Copy
>Application.cutcopymode=false
>End Sub
>************************************************************************************
>
>
>
>
>I would like the range to be copied to the clipboard but to then have
>the selection de-selected.
>
>
>
>
>This code here below also doesn't work:
>************************************************************************************
>Sub SelectTextColumnA()
>Range("A2").Select
>Range(Selection, Selection.End(xlDown)).Select
>Selection.Copy
>Range("B2").Select
>Range("A2").Select
>End Sub
>************************************************************************************
>
>The archives talked about selecting something else outside the range
>(hence the "Range("B2").Select" above followed by the code to get back
>to where I'd like cursor to go, "Range("A2").Select"). But again,
>this doesn't work. There is nothing in the clipboard.
>
>The original code, as shown below in the original message, does work.
>It's just that the range remains selected, which is a pain.
>
>Hope that's clearer. I guess I didn't explain well enough.
>
>(p.s., I apologize for any apparent misspellings. I need to change my
>keyboard. It's a little too sensitive lately. <g>)
>
>Thanks!
>
>>--
>>Don Guillett
>>SalesAid Software
>>(E-Mail Removed)
>>"Don Guillett" <(E-Mail Removed)> wrote in message
>>news:eTtBY%(E-Mail Removed)...
>>> You didn't say where to copy to but try this ONE liner. Change to suit.
>>>
>>> Sub copyTextColumnA()
>>> Range("A2:a" & Cells(2, "a").End(xlDown).Row).Copy Range("i19")
>>> End Sub
>>>
>>> --
>>> Don Guillett
>>> SalesAid Software
>>> (E-Mail Removed)
>>> "StargateFan" <IDon'tAcceptSpam@IDon'tAcceptSpam.com> wrote in message
>>> news:(E-Mail Removed)...
>>>> This one has been asked many times before, I see from the archives.
>>>> But I can't get anything recommended to work.
>>>>
>>>> Here is the code:
>>>> ************************************************************************************
>>>> Sub SelectTextColumnA()
>>>> Range("A2").Select
>>>> Range(Selection, Selection.End(xlDown)).Select
>>>> Selection.Copy
>>>> End Sub
>>>> ************************************************************************************
>>>>
>>>> If I select something else, as recommended, that doesn't get rid of
>>>> tghe marching ants.
>>>>
>>>> If I set the cuut/copy mode to false, as also recommended, the text
>>>> isn't in the clipboard so it nullifies the code:
>>>> Application.CutCopyMode = False
>>>>
>>>> In fact, any of the other recommendations tried do that. The text is
>>>> no longer in the clipboard so the whole macro doesn't work. Is there
>>>> a way to get the text into the clipboard yet de-select the range?
>>>>
>>>> I've tried so much from the archives this morning and nothing works so
>>>> appreciate any help.
>>>>
>>>
>>>

>>


 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      21st Jan 2007
I've been trying to tell em that for the last 2 hours.<G>

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Gord Dibben" <gorddibbATshawDOTca> wrote in message
news:(E-Mail Removed)...
> Fan
>
> You have to do something with the selection before clearing the clipboard
>
> Similar to.............without all the "select" statements
>
> Sub SelectTextColumnA()
> Range(Range("A2"), Range("A2").End(xlDown)).Copy _
> Destination:=Sheets("Sheet2").Range("A1")
> Application.CutCopyMode = False
> End Sub
>
>
> Gord Dibben MS Excel MVP
>
>
> On Sun, 21 Jan 2007 11:02:14 -0500, StargateFan
> <IDon'tAcceptSpam@IDon'tAcceptSpam.com> wrote:
>
>>On Sun, 21 Jan 2007 09:27:48 -0600, "Don Guillett"
>><(E-Mail Removed)> wrote:
>>
>>>It occurs to me that I did not answer your specific question.
>>>application.cutcopymode=false

>>
>>As mentioned, when I use that, nothing gets copied as it clears the
>>clipboard, so it's no good.
>>
>>In order for the range to get de-selected, I put the above code in
>>this position shown below (right above "End Sub"), but it seems that
>>the clipbard gets cleared with this command, so it nullifies the
>>entire macro and so it doesn't work.
>>************************************************************************************
>>Sub SelectTextColumnA()
>>Range("A2").Select
>>Range(Selection, Selection.End(xlDown)).Select
>>Selection.Copy
>>Application.cutcopymode=false
>>End Sub
>>************************************************************************************
>>
>>
>>
>>
>>I would like the range to be copied to the clipboard but to then have
>>the selection de-selected.
>>
>>
>>
>>
>>This code here below also doesn't work:
>>************************************************************************************
>>Sub SelectTextColumnA()
>>Range("A2").Select
>>Range(Selection, Selection.End(xlDown)).Select
>>Selection.Copy
>>Range("B2").Select
>>Range("A2").Select
>>End Sub
>>************************************************************************************
>>
>>The archives talked about selecting something else outside the range
>>(hence the "Range("B2").Select" above followed by the code to get back
>>to where I'd like cursor to go, "Range("A2").Select"). But again,
>>this doesn't work. There is nothing in the clipboard.
>>
>>The original code, as shown below in the original message, does work.
>>It's just that the range remains selected, which is a pain.
>>
>>Hope that's clearer. I guess I didn't explain well enough.
>>
>>(p.s., I apologize for any apparent misspellings. I need to change my
>>keyboard. It's a little too sensitive lately. <g>)
>>
>>Thanks!
>>
>>>--
>>>Don Guillett
>>>SalesAid Software
>>>(E-Mail Removed)
>>>"Don Guillett" <(E-Mail Removed)> wrote in message
>>>news:eTtBY%(E-Mail Removed)...
>>>> You didn't say where to copy to but try this ONE liner. Change to suit.
>>>>
>>>> Sub copyTextColumnA()
>>>> Range("A2:a" & Cells(2, "a").End(xlDown).Row).Copy Range("i19")
>>>> End Sub
>>>>
>>>> --
>>>> Don Guillett
>>>> SalesAid Software
>>>> (E-Mail Removed)
>>>> "StargateFan" <IDon'tAcceptSpam@IDon'tAcceptSpam.com> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> This one has been asked many times before, I see from the archives.
>>>>> But I can't get anything recommended to work.
>>>>>
>>>>> Here is the code:
>>>>> ************************************************************************************
>>>>> Sub SelectTextColumnA()
>>>>> Range("A2").Select
>>>>> Range(Selection, Selection.End(xlDown)).Select
>>>>> Selection.Copy
>>>>> End Sub
>>>>> ************************************************************************************
>>>>>
>>>>> If I select something else, as recommended, that doesn't get rid of
>>>>> tghe marching ants.
>>>>>
>>>>> If I set the cuut/copy mode to false, as also recommended, the text
>>>>> isn't in the clipboard so it nullifies the code:
>>>>> Application.CutCopyMode = False
>>>>>
>>>>> In fact, any of the other recommendations tried do that. The text is
>>>>> no longer in the clipboard so the whole macro doesn't work. Is there
>>>>> a way to get the text into the clipboard yet de-select the range?
>>>>>
>>>>> I've tried so much from the archives this morning and nothing works so
>>>>> appreciate any help.
>>>>>
>>>>
>>>>
>>>

>



 
Reply With Quote
 
Jim Cone
Guest
Posts: n/a
 
      21st Jan 2007
SF,
If you want to retain what you have copied while doing other stuff to
the worksheet, I would look at...
The DataObject object, SetText method and PutInClipboard method.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

 
Reply With Quote
 
StargateFan
Guest
Posts: n/a
 
      21st Jan 2007
On Sun, 21 Jan 2007 09:39:18 -0800, "Jim Cone"
<(E-Mail Removed)> wrote:

>SF,
>If you want to retain what you have copied while doing other stuff to
>the worksheet, I would look at...
>The DataObject object, SetText method and PutInClipboard method.


Thank you. I will look at these new commands. I obviously need to do
something other than what I'm doing. And thank you very much for not
being rude. Sometimes those of us without as much knowledge as all of
you don't know all the variables and when something doesn't work,
don't know that there might be another reason we're not aware of.
Nothing suggested has worked, either given here or in the archives, so
hopefully this will lead me to a solution that does.

Thank you once again. I really appreciate the help.

 
Reply With Quote
 
Jim Cone
Guest
Posts: n/a
 
      21st Jan 2007
You are welcome.
However, I would hesitate to use the rude classification on the old hands here.
I interpreted the responses I saw as frustration.

Also, Chip Pearson has some information on the DataObject at ...
http://www.cpearson.com/excel/clipboard.htm
--
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html



"StargateFan"
<IDon'tAcceptSpam@IDon'tAcceptSpam.com>
wrote in message
On Sun, 21 Jan 2007 09:39:18 -0800, "Jim Cone"
<(E-Mail Removed)> wrote:
>SF,
>If you want to retain what you have copied while doing other stuff to
>the worksheet, I would look at...
>The DataObject object, SetText method and PutInClipboard method.


Thank you. I will look at these new commands. I obviously need to do
something other than what I'm doing. And thank you very much for not
being rude. Sometimes those of us without as much knowledge as all of
you don't know all the variables and when something doesn't work,
don't know that there might be another reason we're not aware of.
Nothing suggested has worked, either given here or in the archives, so
hopefully this will lead me to a solution that does.

Thank you once again. I really appreciate the help.

 
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
Deselect a cell in a discontiguous range Excel_VBA_Newb Microsoft Excel Misc 3 8th Oct 2009 09:02 PM
find within a named range, then deselect the range Bob Mouldy Microsoft Excel Programming 4 23rd Aug 2006 02:48 PM
ActiveChart.Deselect won't Deselect Mark Stephens Microsoft Excel Charting 2 16th Jun 2005 02:54 AM
deselect cells within a range of cells =?Utf-8?B?d2FnYWRv?= Microsoft Excel Misc 3 20th Oct 2004 10:35 PM
"deselect ?" a range or change state from edit to ? mark kubicki Microsoft Excel Programming 1 11th Aug 2004 10:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:37 PM.