+ Reply to Thread
Results 1 to 2 of 2

copy and paste in macro

  1. #1
    Forum Contributor
    Join Date
    03-12-2014
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2016
    Posts
    146

    copy and paste in macro

    I have created a macro that works via the recording feature which copies the information someone types in cell A1 and the pastes that into the FIND feature (CTRL+F). the entire macro works except for 1 problem ...... the macro keeps pasting whatever information was in cell A1 when I created the macro ..... not the information "currently" in cell A1.

    Is there a way to make the macro copy and paste the current information?

    This part of the macro goes as follow:

    highlight A1
    CTRL C
    CTRL F
    highlight input space next to FIND
    CTRL V

  2. #2
    Forum Contributor
    Join Date
    03-12-2014
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2016
    Posts
    146

    Re: copy and paste in macro

    Here is the macro if it helps


    Sub Macro1()
    '
    ' Macro1 Macro
    '

    '
    Cells.Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Range("A1").Select
    Application.CutCopyMode = False
    Selection.Copy
    With Application.ReplaceFormat.Interior
    .PatternColorIndex = xlAutomatic
    .Color = 65535
    .TintAndShade = 0
    .PatternTintAndShade = 0
    End With
    Range("A20:B20").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Replace What:="", Replacement:="", LookAt:=xlPart, SearchOrder _
    :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=True
    Range("A236").Select
    ActiveWindow.SmallScroll Down:=-204
    Rows("20:20").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    ActiveWorkbook.Worksheets("Sheet4").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Sheet4").Sort.SortFields.Add Key:=Range("A21:A268" _
    ), SortOn:=xlSortOnCellColor, Order:=xlDescending, DataOption:= _
    xlSortNormal
    ActiveWorkbook.Worksheets("Sheet4").Sort.SortFields.Add Key:=Range("B21:B268" _
    ), SortOn:=xlSortOnCellColor, Order:=xlDescending, DataOption:= _
    xlSortNormal
    With ActiveWorkbook.Worksheets("Sheet4").Sort
    .SetRange Range("A20:I268")
    .Header = xlYes
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
    End With
    Range("A1").Select
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy paste - cute paste macro almost working
    By graiggoriz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-27-2014, 12:33 PM
  2. Copy & paste in macro doesn't paste all cells
    By pltrapper in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-13-2013, 09:22 AM
  3. [SOLVED] Simple copy and paste macro- Paste special help needed.
    By hernancrespo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2012, 07:02 AM
  4. [SOLVED] Macro to Find, copy, paste, find, copy, paste, find, copy, paste, u get the picture....
    By westsoldman in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-12-2012, 01:12 AM
  5. 2 Macro's: only vertical copy/paste action and copy-paste 14 columns to the right.
    By vdongen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2010, 10:34 AM
  6. Replies: 1
    Last Post: 10-17-2005, 04:05 AM
  7. [SOLVED] Copy and Paste macro needs to paste to a changing cell reference
    By loulou in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-24-2005, 07:06 AM

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