Solved

How do I set the destionation for a vba code to cell A4.

Posted on 2014-12-02
4
100 Views
Last Modified: 2014-12-02
I have a vba code that will paste just the text into a cell from the clipboard, but I need the destination to be A4.

Sub Paste_Unformatted()
    If Application.CutCopyMode = xlCopy Then
        ActiveCell.PasteSpecial Paste:=xlPasteValues
    Else
        ActiveSheet.PasteSpecial Format:="Text", _
                                 Link:=False, _
                                 DisplayAsIcon:=False
    End If
End Sub

Open in new window

0
Comment
Question by:kbay808
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 51

Expert Comment

by:Rgonzo1971
ID: 40475364
Hi,

pls try

Sub Paste_Unformatted()
    If Application.CutCopyMode = xlCopy Then
        Range("A4").PasteSpecial Paste:=xlPasteValues
    Else
        Range("A4").PasteSpecial Format:="Text", _
                                 Link:=False, _
                                 DisplayAsIcon:=False
    End If
End Sub

Open in new window

Regards
0
 

Author Comment

by:kbay808
ID: 40475378
I'm receiving an error.  Please see the attached screen shot.
Error-Screen-Shot.jpg
0
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40475399
pls try

Sub Paste_Unformatted()
    If Application.CutCopyMode = xlCopy Then
        Range("A4").PasteSpecial Paste:=xlPasteValues
    Else
        ActiveSheet.Range("A4").Select
        ActiveSheet.PasteSpecial Format:="Text", _
                                 Link:=False, _
                                 DisplayAsIcon:=False
    End If
End Sub

Open in new window

0
 

Author Closing Comment

by:kbay808
ID: 40475401
That worked perfect!!!  Thank you very much.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question