VBA code pastespecial

tjlawren1

New Member
Joined
Jul 10, 2019
Messages
2
Hi All,
I hope someone can help me. I have a code that copies and pastes training programs from the planning sheet to the for that specific athlete. I want it to do this but without pulling through the formula in the cells just the numbers/txt/picture in the cells.

The code i'm currently using is below and hoping it can be adapted

Code:
[/INDENT]
[INDENT]athname = Range("D1").Text[/INDENT]
[INDENT]Application.Goto reference:="Print_Area"[/INDENT]
[INDENT]
[/INDENT]
[INDENT]    Dim wkSht As Worksheet[/INDENT]
[INDENT]    For Each wkSht In Sheets[/INDENT]
[INDENT]    If ActiveSheet.Range("D1").Value = wkSht.Name Then[/INDENT]
[INDENT]    ActiveSheet.Range("Print_Area").Copy Destination:=wkSht.Range("A1")

I hope this makes sense, and someone can help.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Re: VBA code specialpaste help

Wlecome to the board. Make a backup copy of your file, replace above with below and try:
Code:
    Dim s As String: s = ActiveSheet.Cells(1, 4).Text
    Dim r As Range: Set r = Range("Print_Area")
    Dim x   As Long
    
    Application.Goto r, True
    
    For x = 1 To Worksheets.Count
        With Sheets(x)
            If .Cells(1, 4).Value = .Name Then
                .Cells(1, 1).Resize(r.Rows.Count, r.Columns.Count).Value = r.Value
            End If
        End With
    Next x

    Set r = Nothing
 
Last edited:
Upvote 0
Re: VBA code specialpaste help

As I can't see your screen nor spreadsheet, "that didn't work" doesn't really detail which line didn't work or what the error message is I'm afraid.

Pretend anyone reading this thread can't see your PC screen. How much information should you give to accurately explain the problem and to receive a working answer?
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top