View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett[_2_] Don Guillett[_2_] is offline
external usenet poster
 
Posts: 1,522
Default clean up code a little

If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"terilad" wrote in message
...
Don,

How could this coe be wriiten for the cells to copy from are from stock
maintenance sheet and cells c3,c4,c5 and so until c52 and then cells
f3,f4,f5
until f52

Any ideas.

Thanks

Mark

"Don Guillett" wrote:

Sub ApplyStock()
with Sheets("Stock Maintenance")
..Range("C3").Copy sheet4.Range("B7")
..Range("C4").Copy Sheet5.Range("B7")
..Range("C5").Copy Sheet6.Range("B7")
..Range("C6").Copy Sheet7.Range("B7")
end with
End Sub

Even better
Sub stockbetter()
With Sheets("sheet1")
For i = 3 To 6
.Cells(i, "c").Copy Sheets(i + 1).Range("b7")
Next i
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"terilad" wrote in message
...
Hi I have a copy and paste code

I was wondering if there is a way to clean it up a little to run it
more
better.

Here's my code.

Sub ApplyStock()
Range("C3").Copy
Sheet4.Select
Range("B7").Select
ActiveSheet.Paste
Sheets("Stock Maintenance").Select
Range("C4").Copy
Sheet5.Select
Range("B7").Select
ActiveSheet.Paste
Sheets("Stock Maintenance").Select
Range("C5").Copy
Sheet6.Select
Range("B7").Select
ActiveSheet.Paste
Sheets("Stock Maintenance").Select
Range("C6").Copy
Sheet7.Select
Range("B7").Select
ActiveSheet.Paste
End Sub

Many thanks


Mark


.