Results 1 to 8 of 8

VBA code to copy and paste to next cell

Threaded View

  1. #1
    Registered User
    Join Date
    05-26-2015
    Location
    Australia
    MS-Off Ver
    MS Office 13
    Posts
    16

    VBA code to copy and paste to next cell

    I am trying to write a simple macro in excel to do some calculations and copy and paste the sum from cell O2 to cell T2. Do some more calculations and copy and paste the sum from cell O2 to cell T3 (next cell) and continue the process till it's finished. I am not sure how I can get code to paste the value in the next cell (T3). Here are the codes I have done so far. Can you please help? Thank you.

    Sub CountingValue()
    Dim N1 As Long
    Dim N2 As Long
    
    For N1 = 1 To 45
    For N2 = 2 To 45
    Range("K2").Select
    ActiveCell.FormulaR1C1 = N1
    Range("L2").Select
    ActiveCell.FormulaR1C1 = N2
    ActiveCell.Offset(-1, 3).Range("A1").Select
    Selection.Copy
    ActiveCell.Offset(1, 5).Range("A1").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Application.CutCopyMode = False
    ActiveCell.Offset(1, 0).Range("A1").Select
    Application.Wait (Now + TimeValue("0:00:05"))
    Next
    Application.Wait (Now + TimeValue("0:00:10"))
    Next
    
    End Sub
    Last edited by davesexcel; 03-14-2021 at 07:16 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA code for copy paste data to active cell
    By keshavtale in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2020, 02:58 AM
  2. Excel VBA code to copy a Range and paste it within a cell
    By rshnkmr39 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-17-2014, 02:40 AM
  3. Code to copy and paste cell value from last used row to new row not working
    By figbash in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-11-2014, 02:02 PM
  4. VBA Code to copy cell range and paste to certain sheet
    By goguneon in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-03-2013, 08:35 AM
  5. VBA code to copy cell value and paste in different sheet
    By mubashar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2013, 01:26 AM
  6. Code to Copy, Divide Cell Content and Paste
    By AntiPivotTable in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-30-2013, 07:59 PM
  7. [SOLVED] Code to search a cell, copy and paste
    By MDEN in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-18-2012, 05:19 AM

Tags for this Thread

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