#1   Report Post  
Posted to microsoft.public.excel.misc
Alec H
 
Posts: n/a
Default Macro problem.......


Hi,

I am using a macro to cut a single cell from 15 rows of a column of a
worksheet and then pasting the data into another 15 cells in another
worksheet.

The macro appears to work perfectly, except that if I filter the
initial worksheet the macro still copies the first 15 rows of the
worksheet NOT the first 15 filtered rows......

the "offending" line of script currently is:

Range("A1:A15").Select

Help, please.


--
Alec H
------------------------------------------------------------------------
Alec H's Profile: http://www.excelforum.com/member.php...o&userid=31042
View this thread: http://www.excelforum.com/showthread...hreadid=512581

  #2   Report Post  
Posted to microsoft.public.excel.misc
flummi
 
Posts: n/a
Default Macro problem.......

Include this in your code to see what actually has been selected and
hence would be copied:

MsgBox ActiveWindow.RangeSelection.Address


Hans

  #3   Report Post  
Posted to microsoft.public.excel.misc
Alec H
 
Posts: n/a
Default Macro problem.......


Hans,

You posted...


Include this in your code to see what actually has been selected and
hence would be copied:

MsgBox ActiveWindow.RangeSelection.Address

Forgive me for being stupid, but when I insert this into my code above
the "offending" line (Range("A1:A15").Select) it appears to merely
opens a message box and does not direct the following lines of code to
copy the first 15 lines of selected data ready for pasting elsewhere.

Here is my complete code as it stands;


Sheets("Customer List").Select
MsgBox ActiveWindow.RangeSelection.Address
Range("A1:A15").Select
Selection.Copy
Sheets("Stage 1 - Visit diary").Select
Range("E4:E18").Select
ActiveSheet.Paste
Sheets("Customer List").Select


I know it is only simple, but so am I...:(


--
Alec H
------------------------------------------------------------------------
Alec H's Profile: http://www.excelforum.com/member.php...o&userid=31042
View this thread: http://www.excelforum.com/showthread...hreadid=512581

  #4   Report Post  
Posted to microsoft.public.excel.misc
flummi
 
Posts: n/a
Default Macro problem.......

Hi Alec,

Try this:

Set r1 = Worksheets("Customer List")
r1.Activate
r1.Range("A1:A15").Select
Selection.Copy
Set r2 = Worksheets("Stage 1 - Visit diary")
r2.Activate
r2.Range("E4:E18").Select
ActiveSheet.Paste
Sheets("Customer List").Activate


Hans

  #5   Report Post  
Posted to microsoft.public.excel.misc
Alec H
 
Posts: n/a
Default Macro problem.......


That worked,

Thanks Hans :)


--
Alec H
------------------------------------------------------------------------
Alec H's Profile: http://www.excelforum.com/member.php...o&userid=31042
View this thread: http://www.excelforum.com/showthread...hreadid=512581

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
deleting a macro resulted in a problem militant Excel Discussion (Misc queries) 0 April 26th 05 05:21 AM
Circular Problem needs Macro NICK Excel Discussion (Misc queries) 2 February 1st 05 09:09 AM
External data Macro Problem Excel 97 Craig Kelly Excel Discussion (Misc queries) 1 January 17th 05 03:17 PM
Problem executing a macro from different workbook where it is Sergio Calleja Excel Discussion (Misc queries) 1 January 17th 05 12:38 PM
macro problem Kevin Excel Discussion (Misc queries) 1 December 14th 04 10:47 PM


All times are GMT +1. The time now is 10:02 AM.

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

About Us

"It's about Microsoft Excel"