View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
David Adamson[_4_] David Adamson[_4_] is offline
external usenet poster
 
Posts: 61
Default my macro is clearing the wrong sheet

A wild guess to your problem is that you haven't reference the sheet
correctly where you want the code to run.

There are 2 options here.

1. activate the worksheet where you want to code to execute.
Sub My Macro
Worksheets("Data").activate 'data is the sheets name, put this code before
the rest.

'your code

End sub

2. learn to use

Sub MyMacro()
Dim item as range

With Worksheets("Data") ' data is just the sheets name
item = .range("i4:j4") 'you must use the . or it will use the data from
the active worksheet

End with

End sub

by learnig to use the above its alot easier getting data from all over the
workbook

have fun

"Polarbear" wrote in message
...
Not sure how to do that -- I'm not too good at writting macros other than
just recording what I do -- mistakes scrolling and all -- I printed the
macro
it took up over two pages but i can try to past it here if it fits ?

Range("I4:J4").Select
Selection.Copy
ActiveWindow.SmallScroll ToRight:=6