PC Review


Reply
Thread Tools Rate Thread

Add text to Range of cells

 
 
jlclyde
Guest
Posts: n/a
 
      2nd Nov 2010
I have a range that I need to add the same text to if the cell is
visible. Is there a way to do this without putting in a loop? Here
is my code.

Thanks,
Jay
Set Rng = .AutoFilter.Range.Offset(1,
0).Resize(.AutoFilter.Range.Rows.Count - 1) _
.SpecialCells(xlCellTypeVisible)

If .Rows(.Rows.Count).Row <> 4 Then
Set Rng = .Range("A5:A" & Lstrow)
Set Rng = Rng.SpecialCells(xlCellTypeVisible)
Rng.Value = Rng.Value & "N"
End If
 
Reply With Quote
 
 
 
 
Don Guillett Excel MVP
Guest
Posts: n/a
 
      2nd Nov 2010
On Nov 2, 8:11*am, jlclyde <jlcl...@taylorcorp.com> wrote:
> I have a range that I need to add the same text to if the cell is
> visible. *Is there a way to do this without putting in a loop? *Here
> is my code.
>
> Thanks,
> Jay
> * * * * Set Rng = .AutoFilter.Range.Offset(1,
> 0).Resize(.AutoFilter.Range.Rows.Count - 1) _
> * * * * * * .SpecialCells(xlCellTypeVisible)
>
> * * * * * * If .Rows(.Rows.Count).Row <> 4 Then
> * * * * * * * * Set Rng = .Range("A5:A" & Lstrow)
> * * * * * * * * Set Rng = Rng.SpecialCells(xlCellTypeVisible)
> * * * * * * * * Rng.Value = Rng.Value & "N"
> * * * * * * End If


If ?? every cell in the range ends with the same thing such as M then
columns(1).replace "M", "MN"
else loops shouldn't be too slow these days.
 
Reply With Quote
 
jlclyde
Guest
Posts: n/a
 
      2nd Nov 2010

> If ?? every cell in the range ends with the same thing such as M then
> columns(1).replace "M", "MN"
> else loops shouldn't be too slow these days.


All of the cells do not end with a specific value. Good thinking
though. I know the loop runs fast; I am just wonderign if there is a
way to avoid the loop. I already have several loops in this
subroutine and thought I woudl try to avoid another oner.

Thanks,
Jay
 
Reply With Quote
 
Don Guillett Excel MVP
Guest
Posts: n/a
 
      3rd Nov 2010
On Nov 2, 12:41*pm, jlclyde <jlcl...@taylorcorp.com> wrote:
> > If ?? every cell in the range ends with the same thing such as M then
> > columns(1).replace "M", "MN"
> > else loops shouldn't be too slow these days.

>
> All of the cells do not end with a specific value. *Good thinking
> though. *I know the loop runs fast; I am just wonderign if there is a
> way to avoid the loop. *I already have several loops in this
> subroutine and thought I woudl try to avoid another oner.
>
> Thanks,
> Jay

"If desired, send your file to dguillett @gmail.com I will only look
if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results."

 
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
Check text in range of cells tommcbrny Microsoft Excel Misc 2 11th Sep 2009 05:11 PM
how can I delete cells containing text within a range of cells jackwmbg Microsoft Excel Misc 2 6th Jun 2008 09:08 PM
How to find text in a range of cells? r.e.s. Microsoft Excel Misc 5 5th Jan 2007 03:59 PM
Text box that contains a range of cells not just one. =?Utf-8?B?Q2hpbGkgRG9u?= Microsoft Excel Charting 1 1st Mar 2006 09:10 PM
Counting Occurrence of Text within Text in Cells in Range. =?Utf-8?B?SmVyZW15IE4u?= Microsoft Excel Worksheet Functions 1 8th Sep 2005 05:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:46 AM.