View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
cereldine[_28_] cereldine[_28_] is offline
external usenet poster
 
Posts: 1
Default improving workbook activate


I've tried experimenting with the code but are not having much joy,
im trying to find the value in workbook two, copy the range go back to
workbook 1 and paste it then find the next value to paste, the loop
concened with this is

Set dCell = bk2.Worksheets("i_calcs").Cells.Find(sCode)

''bk2.Worksheets("i_calcs").Range(dCell).Offset(1,
0).Select
Range(Selection, dCell.End(xlDown)).Copy

bk1.Activate
rng.Offset(0, 1).Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True


Set rng = rng.Offset(1, 0)
Application.CutCopyMode = False

Loop Until rng = ""

the bit in pink produces the error, can you see what is wrong with it,
normally i would use something like
wb1.activate
sheets("i_calc").activate
Range(dCell).Offset(1, 0).Select

this is what i'm trying to get away from, thanks


--
cereldine
------------------------------------------------------------------------
cereldine's Profile: http://www.excelforum.com/member.php...o&userid=32069
View this thread: http://www.excelforum.com/showthread...hreadid=538000