+ Reply to Thread
Results 1 to 4 of 4

pasting value using a button

  1. #1
    Registered User
    Join Date
    03-09-2007
    Posts
    6

    Unhappy pasting value using a button

    Hi everybody i'm trying to copy a value from one cell on sheet1 for example to paste it on Sheet2 by using a button this is the formula i'm using :

    Sheets("Sheet1").Select
    Range("E24").Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("A1").Select
    Selection.End(xlDown).Select
    Selection.End(xlDown).Select
    Selection.End(xlUp).Select
    Selection.Offset(1, 0).Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
    False, Transpose:=False

    andit is giving me Subscript out of range in the line (range ("A1").Select, can anyone please tell me what am i doing wrong, specially when i used the same formula in the past and it worked

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    First, when posting, wrap your code using the # button in the editing window.

    Second, It appears you want to copy the value in Sheet1!E24. What cell, exactly, are you trying to paste it into? This can be done without selecting any sheets, cells or even using the copy/paste functions. In VBA, you can simply set the value of a cell on one sheet to the value of a cell on another.

    For example:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-09-2007
    Posts
    6
    Actually Paul, what i am trying to do is take the value on a sheet that i use as an invoice and post it to another sheet , so i cannot use the formula you specified because i need to add up values to a new row each time i post from one sheet to another, i hope this explains to you a bit what i want to do

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Please post a copy of your workbook with any private data removed. Leave enough "fake" data that I can at least get a picture of which cells you want moved to where. We should be able to get you a solution pretty quickly that way.

    Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1