Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 355
Default Move down one line

Sub Test()
Workbooks.Open Filename:= MyPath\myfile.xls
Windows("File1.xls").Activate
Range("BP18:BU18").Select
Selection.Copy
Windows("myfile").Activate
Range("Q1").Select
Selection.End(xlDown) (2, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWorkbook.Save
ActiveWorkbook.Close

End Sub

This code is run daily and copies BP18:BU18 to a summary sheet. The first
run should copy to Q9 the next day should be Q10 etc.
How do I modify "Selection.End(xlDown) (2, 1).Select" to move down one line
each time this code runs? Or should I be using something different to
accomplish this?
Thanks
Sandy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Move down one line

Sub Test()
Dim MyPath as String
Dim bk as Workbook, sh as Worksheet, rng as Range
MyPath = "C:\MyFolder"
set bk = Workbooks.Open( Filename:= MyPath & "\myfile.xls")
set sh = Workbooks("File1.xls").Activesheet
set rng = Workbooks("myfile.xls").Worksheets(1).Range("Q9")
if not isempty( rng) then
set rng = rng.Parent.Cells(rows.count,"Q").End(xlup)(2)
End if
sh.Range("BP18:BU18").Copy
rng.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
bk.Close SaveChanges:=True
End Sub

--
Regards,
Tom Ogilvy

"Sandy" wrote in message
...
Sub Test()
Workbooks.Open Filename:= MyPath\myfile.xls
Windows("File1.xls").Activate
Range("BP18:BU18").Select
Selection.Copy
Windows("myfile").Activate
Range("Q1").Select
Selection.End(xlDown) (2, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks

_
:=False, Transpose:=False
ActiveWorkbook.Save
ActiveWorkbook.Close

End Sub

This code is run daily and copies BP18:BU18 to a summary sheet. The first
run should copy to Q9 the next day should be Q10 etc.
How do I modify "Selection.End(xlDown) (2, 1).Select" to move down one

line
each time this code runs? Or should I be using something different to
accomplish this?
Thanks
Sandy



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Move to next line bgkgmg Excel Worksheet Functions 1 May 6th 08 02:21 PM
Move data from one line to another Chip Excel Discussion (Misc queries) 2 February 22nd 08 12:10 AM
If a criteria isn't met, move to the next line.... Martc Excel Discussion (Misc queries) 2 March 22nd 06 01:21 PM
Line and text box move by themselves David Brown Charts and Charting in Excel 1 August 17th 05 03:16 PM
Move equations from line to line automatically Kingsobes Excel Discussion (Misc queries) 1 August 4th 05 07:57 PM


All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"