Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The macro below leaves two sheets with a highlighted column on
each.How do I do this copy/paste without selecting data leaving both sheets without any highlighted cells? Sub WriteMap() Dim MySheet As Variant Dim MyTarget As Variant MySheet = ActiveSheet.Name MyTarget = Range("A1").Value Range("S2:S293").Select Selection.Copy Sheets("Sheet1").Select Range("C" & MyTarget).Select Selection.PasteSpecial Paste:=xlValues Sheets(MySheet).Select End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Try this Sub WriteMap() Dim MySheet As String Dim MyTarget As Long MySheet = ActiveSheet.Name MyTarget = Range("A1").Value Range("S2:S293").Copy Sheets("Sheet1").Range("C" & MyTarget).PasteSpecial Paste:=xlValues Application.Goto Worksheets("Sheet1").Range("A1"), True Sheets(MySheet).Select End Sub "Fan924" wrote: The macro below leaves two sheets with a highlighted column on each.How do I do this copy/paste without selecting data leaving both sheets without any highlighted cells? Sub WriteMap() Dim MySheet As Variant Dim MyTarget As Variant MySheet = ActiveSheet.Name MyTarget = Range("A1").Value Range("S2:S293").Select Selection.Copy Sheets("Sheet1").Select Range("C" & MyTarget).Select Selection.PasteSpecial Paste:=xlValues Sheets(MySheet).Select End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Feb 27, 12:19*pm, Fan924 wrote:
The macro below leaves two sheets with a highlighted column on each.How do I do this copy/paste without selecting data leaving both sheets without any highlighted cells? Sub WriteMap() Dim MySheet As Variant Dim MyTarget As Variant * * MySheet = ActiveSheet.Name * * MyTarget = Range("A1").Value * * Range("S2:S293").Select * * Selection.Copy * * Sheets("Sheet1").Select * * Range("C" & MyTarget).Select * * Selection.PasteSpecial Paste:=xlValues * * Sheets(MySheet).Select End Sub After you do the copy, add something like Range("A1").Select You still have something selected but its only 1 cell, hardly noticeable. I don't know a way to unselect everything. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() As you are doing a PasteSpecial Values, instead try Sub WriteMap() Dim Rng As Range Set Rng = Range("S2:S293") Sheets("Sheet1").Range("C" & Range("A1")).Resize(Rng.Cells.Count).Value = Rng.Value End Sub -- mdmackillop ------------------------------------------------------------------------ mdmackillop's Profile: http://www.thecodecage.com/forumz/member.php?userid=113 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=69236 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Feb 27, 1:36 pm, mdmackillop
wrote: As you are doing a PasteSpecial Values, instead try Sub WriteMap() Dim Rng As Range Set Rng = Range("S2:S293") Sheets("Sheet1").Range("C" & Range("A1")).Resize(Rng.Cells.Count).Value = Rng.Value End Sub -- mdmackillop ------------------------------------------------------------------------ mdmackillop's Profile:http://www.thecodecage.com/forumz/member.php?userid=113 View this thread:http://www.thecodecage.com/forumz/sh...ad.php?t=69236 Exactly what I was looking for mdmackillop, thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I copy big ranges of cells without drag or copy/paste? | Excel Discussion (Misc queries) | |||
Copy and paste versus copy and insert copied cells | New Users to Excel | |||
Macro to copy highlighted cells to csv file | Excel Programming | |||
Copy/Paste how to avoid the copy of formula cells w/o calc values | Excel Discussion (Misc queries) | |||
Why dosen't my paste button come up highlighted? | Excel Discussion (Misc queries) |