Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Picture pasting where it should but also in alot of cells it shouldn't

HELP..........

I have the following Macro:

Sub Week1()
'
' Week1 Macro
' Macro recorded 10/31/2007 by ******
'
Windows("Weather Report - SPLY.xls").Activate
Sheets("1-08").Select
Range("B3:H6").Select
Application.CutCopyMode = False
Selection.Copy
Windows("NEW-TACS-PLAN-OT.xls").Activate
Sheets("FUNC 1").Select
Range("B46").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("Weather Report - SPLY.xls").Activate
Sheets("1-08").Select
Range("B8:H11").Select
Application.CutCopyMode = False
Selection.Copy
Windows("NEW-TACS-PLAN-OT.xls").Activate
Sheets("FUNC 2B").Select
Range("B46").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("Weather Report - SPLY.xls").Activate
Sheets("1-08").Select
Range("B13:H16").Select
Application.CutCopyMode = False
Selection.Copy
Windows("NEW-TACS-PLAN-OT.xls").Activate
Sheets("FUNC 4").Select
Range("B46").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("Weather Report - SPLY.xls").Activate
Sheets("1-08").Select
Range("B18:H21").Select
Application.CutCopyMode = False
Selection.Copy
Windows("NEW-TACS-PLAN-OT.xls").Activate
Sheets("OTHER").Select
Range("B46").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
With Workbooks("Weather Report - SPLY.xls").Sheets("1-08")
If .Range("A2").Value = "FUNCTION 1" Then
Set picSource = .Range("B1")
With Workbooks("NEW-TACS-PLAN-OT.xls")
vWorksheetNames = Array("DISTRICT ROLL-UP", "FUNC 1",
"FUNC 2B", "FUNC 4", "OTHER")
For Each vName In vWorksheetNames
With .Worksheets(vName)
picSource.Copy
.Paste
Set picDest = .Pictures(.Pictures.Count)
With .Range("B44")
picDest.Top = .Top + (.Height -
picDest.Height) / 2
picDest.Left = .Left + (.Width -
picDest.Width) / 2
End With
End With
Next vName
End With
End If
End With
'
End Sub

It does what it is supposed to do by copying and pasting all the
figures as required. It them selects the image in "B1" as it is
supposed to and Pastes it into the other workbook in cell "B44" as it
is supposed to, however it is also then pasting the same picture in
the cells beginning with range B46 where all of the figures were just
pasted and of course overwriting the data I just placed in those
cells.

I can't find what I am doing wrong.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Picture pasting where it should but also in alot of cells it shouldn't


I added the destination cell for your paste operation.
I have no way of testing my change, but give it a try...
'---
With .Worksheets(vName)
picSource.Copy
.Paste .Range("B44") '<<<<<<<<<<<<<<
Set picDest = .Pictures(.Pictures.Count)
With .Range("B44")
picDest.Top = .Top + (.Height - picDest.Height) / 2
picDest.Left = .Left + (.Width - picDest.Width) / 2
End With
End With
'---
Also, four variables are not declared.
Add "Option Explicit" as the first line in your module to find out which ones.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)





wrote in message
HELP..........
I have the following Macro:
-snip-
It does what it is supposed to do by copying and pasting all the
figures as required. It them selects the image in "B1" as it is
supposed to and Pastes it into the other workbook in cell "B44" as it
is supposed to, however it is also then pasting the same picture in
the cells beginning with range B46 where all of the figures were just
pasted and of course overwriting the data I just placed in those
cells.
I can't find what I am doing wrong.

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
Pasting a picture in a cell wnfisba Excel Discussion (Misc queries) 1 May 6th 07 05:50 PM
Pasting a Selection as a Picture [email protected] Links and Linking in Excel 3 February 7th 07 01:10 PM
Copy and pasting on columns but on spreadsheet with alot of data Michael Excel Discussion (Misc queries) 2 October 10th 06 01:49 PM
moving alot of data (10000 cells) from a column to a row Paul Knight Excel Discussion (Misc queries) 3 August 21st 06 12:58 PM
pasting screendump picture in VBA form R.G. Vervoort Excel Programming 2 April 15th 05 09:29 AM


All times are GMT +1. The time now is 12:35 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"