Re: Endless loop?
- From: "STEVE BELL" <AYNrand451@xxxxxxxxxxx>
- Date: Mon, 01 Aug 2005 19:38:47 GMT
John,
Are you looking for something like
set rng1 = Sheets("Sheet1").Range("A1:D5")
set rng2 = Sheets("Sheet2").Range("M6:P10")
rng2.value = rng1.value
or
Sheets("Sheet2).Cell(x,y).value = Sheets("Sheet1").Cell(a,b).value
no copy/paste needed.
--
steveB
Remove "AYN" from email to respond
"John" <John@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A69A8B3B-631B-48B6-8464-5FABC9C6A421@xxxxxxxxxxxxxxxx
> is there a way to tell the code to "find" only cell values... rather than
> the
> formula itslef? In other words, is there a way that i won't have to copy
> and
> paste values for the code to work.
>
> "John" wrote:
>
>> If I copy and paste values in my formula (true/false) column it all works
>> fine... again assuming a smaller sample size...
>>
>> "FSt1" wrote:
>>
>> > hi,
>> > i think it is the cut/copy part of your do loop that is crashing the
>> > macro.
>> > it has been my experience that the cut and copy commands should not be
>> > used
>> > in a macro excessively. once or twice is ok but with inside a loop, i
>> > wouldn't have done it that way.
>> > you can add this just before the cut command.
>> >
>> > Application.CutCopyMode = False
>> >
>> > that will clear the clipboard.
>> > if that don't work then you will have to use another way. maybe with
>> > variable. post back if it don't work and is before 4:00Pm EDT US.
>> >
>> > regards
>> >
>> > FSt1
>> >
>> >
>> > "John" wrote:
>> >
>> > > I have a piece of code that I am experimenting with and it crashes my
>> > > excel... have I set up an endless loop? The idea is that if a
>> > > certian column
>> > > in the *** equals "true" then cut that row and paste it into a new
>> > > ***.
>> > >
>> > > Thanks for the help!
>> > >
>> > > Sub NI()
>> > > '
>> > >
>> > > '
>> > > Application.ScreenUpdating = False
>> > > Application.Calculation = xlCalculationManual
>> > > Sheets("t0983101").Select
>> > > Range("E4").Select
>> > > Range(Selection, Selection.End(xlDown)).Select
>> > > Application.CutCopyMode = False
>> > > Selection.Copy
>> > > Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
>> > > SkipBlanks _
>> > > :=False, Transpose:=False
>> > > Range("A4").Select
>> > > Dim rngToSearch As Range
>> > > Dim wks As Work***
>> > > Dim rngFound As Range
>> > >
>> > > Set wks = Sheets("t0983101")
>> > > Set rngToSearch = wks.Columns(24)
>> > >
>> > > Set rngFound = rngToSearch.Find("true")
>> > > If rngFound Is Nothing Then
>> > > MsgBox "No NI Trades Found"
>> > > Else
>> > > Do
>> > > rngFound.EntireRow.Cut
>> > > Sheets("NI").Select
>> > > Range("A9").Select
>> > > Selection.End(xlDown).Select
>> > > ActiveCell.Offset(1, 0).Select
>> > > Active***.Paste
>> > > Set rngFound = rngToSearch.FindNext
>> > > Loop Until rngFound Is Nothing
>> > > End If
>> > > Application.ScreenUpdating = True
>> > > Application.Calculation = xlCalculationAutomatic
>> > > End Sub
>> > >
>> > >
>> > >
.
- Follow-Ups:
- Re: Endless loop?
- From: John
- Re: Endless loop?
- References:
- Endless loop?
- From: John
- RE: Endless loop?
- From: FSt1
- RE: Endless loop?
- From: John
- RE: Endless loop?
- From: John
- Endless loop?
- Prev by Date: Re: Safeguarding Excel Products from Piracy
- Next by Date: Re: Rename a ***
- Previous by thread: RE: Endless loop?
- Next by thread: Re: Endless loop?
- Index(es):