Consulting

Results 1 to 4 of 4

Thread: Paste/Special/Values

  1. #1

    Paste/Special/Values

    Dear Mister(s) Vbax,
    I use a Range of Cells to hold information, Ie: on Cell E9 I have =D9&" "&G9, then for E10 I have =D10&" "&G10 and so on and so forth about ten rows down. The Range E10:E25 is formatted for aesthetic purposes with white font and background.
    I’m trying to Copy and Paste the information from such Range into another Worksheet. I’ve tried the Paste/ Special /Values and not only the Pasting is done keeping the source formatting, but it also forms a block if information I cannot see even if I reformat the Range to default settings, meaning for background and font color. See the code I'm using at the bottom.

    So, could any of you please help me with some code that will help me solve this dilemma? - Note: I would also now need to transpose the pasting.

    Thank you,

    Marco.-
    Code:
    Sub go_to()
    '
    ' go_to Macro
    '
    '
    Sheets("Notes Tool").Select
    Range("E8:E33").Select
    Selection.Copy

    Sheets("NOTE JOURNAL2").Select
    'Range("A1").Select
    Application.SendKeys "^{END}", Wait
    Application.SendKeys "^{END}", Wait

    '--------------------------------------------
    Dim PauseTime, Start, Finish, TotalTime
    'If (MsgBox("Press Yes to pause for 5 seconds", 4)) = vbYes Then
    PauseTime = 5 ' Set duration.
    Start = Timer ' Set start time.
    Do While Timer < Start + PauseTime
    DoEvents ' Yield to other processes.
    Loop
    Finish = Timer ' Set end time.
    '-----------------------------------------------

    'Application.SendKeys "^"{END}", Wait
    Application.SendKeys "{DOWN}", Wait
    Application.SendKeys "{DOWN}", Wait
    Application.SendKeys "{DOWN}", Wait
    Application.SendKeys "{DOWN}", Wait
    'Application.SendKeys "{LEFT}", Wait
    'Application.SendKeys "{LEFT}", Wait
    'Application.SendKeys "{LEFT}", Wait
    'Application.SendKeys "{LEFT}", Wait
    'Application.SendKeys "{LEFT}", Wait
    'Application.SendKeys "{LEFT}", Wait
    'Application.SendKeys "{LEFT}", Wait
    'Application.SendKeys "{LEFT}", Wait
    ''Application.SendKeys "{ENTER}", Wait
    'Dim PauseTime, Start, Finish, TotalTime
    'PauseTime = 5 ' Set duration.
    ' Start = Timer ' Set start time.
    ' Do While Timer < Start + PauseTime
    ' DoEvents ' Yield to other processes.
    'Application.SendKeys "{ENTER}", Wait

    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    ActiveSheet.Paste
    Application.CutCopyMode = False

    Application.SendKeys "^{ENTER}", Wait
    Application.SendKeys "{DOWN}", Wait
    Application.SendKeys "{DOWN}", Wait
    Application.SendKeys "{DOWN}", Wait
    Application.SendKeys "{DOWN}", Wait
    Application.SendKeys "{DOWN}", Wait


    End Sub

  2. #2
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Hi Ben, welcome to the board. could you possibly post a sample of the data by selecting the go advanced button and scrolling down till you find a button that says "manage attachments"?

    be sure no private or proprietary info is included in the example workbook.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3

    Paste/Special/Values/Transpose

    To simplify the question all I'm trying to do is a code to Copy/Paste/Special/Values/Transpose a Range into/and to be added to a database in another worksheet. I use the Values option to remove the cell and font special format in the data source. Thank you for your help . . . Marco.-

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    This is pasting the values, then pasting again the whole of the cell formatting etc.
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    ActiveSheet.Paste

    Try
    [vba]
    Sub go_to()
    Sheets("Notes Tool").Range("E8:E33").Copy
    Sheets("NOTE JOURNAL2").Range("A1").PasteSpecial Paste:=xlPasteValues
    End Sub

    'To Transpose
    Sub go_to_Transpose()
    Sheets("Notes Tool").Range("E8:E33").Copy
    Sheets("NOTE JOURNAL2").Range("A1").PasteSpecial Paste:=xlPasteValues, Transpose:=True
    End Sub


    [/vba]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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