ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   range copy and paste special within macro (https://www.excelbanter.com/excel-programming/439331-range-copy-paste-special-within-macro.html)

enahs_naneek via OfficeKB.com

range copy and paste special within macro
 
I am trying to select a range (hyperlink) a table and replace that range
(application.goto ...etc) with another based on the row reference number
contained in cell V22. This procedure is part of a macro Using the code below
appears to be ignoring either the copy or the paste special function, the
result being no error but the range remaining unchanged. Any help much
appreciated.

Range("V24").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Selection.Copy
If V22 = 1 Then
Application.Goto Reference:="AW21:BL21"
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ElseIf V22 = 2 Then
Application.Goto Reference:="AW22:BL22"
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
"above repeated with incremental changes to goto reference"
.................................................. .........................
End If

--
Message posted via http://www.officekb.com


Don Guillett[_2_]

range copy and paste special within macro
 
Methinks you are making this a lot more difficult than necessary.
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

"enahs_naneek via OfficeKB.com" <u58016@uwe wrote in message
news:a3599a7ce3820@uwe...
I am trying to select a range (hyperlink) a table and replace that range
(application.goto ...etc) with another based on the row reference number
contained in cell V22. This procedure is part of a macro Using the code
below
appears to be ignoring either the copy or the paste special function, the
result being no error but the range remaining unchanged. Any help much
appreciated.

Range("V24").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Selection.Copy
If V22 = 1 Then
Application.Goto Reference:="AW21:BL21"
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
ElseIf V22 = 2 Then
Application.Goto Reference:="AW22:BL22"
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
"above repeated with incremental changes to goto reference"
.................................................. ........................
End If

--
Message posted via
http://www.officekb.com



Jef Gorbach[_2_]

range copy and paste special within macro
 
Untested, but looks like your code segement is trying to:

Range("V24").Hyperlinks(1).Copy
Select Case Range("V22").Value
Case 1: TargetRange = "AW21:BL21"
Case 2: TargetRange = "AW22:BL22"
End Select
Range(TargetRange).PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False






All times are GMT +1. The time now is 07:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com