+ Reply to Thread
Results 1 to 9 of 9

VBA copy paste

Hybrid View

bjcowen9000 VBA copy paste 02-10-2014, 06:48 PM
Olly Re: VBA copy past 02-10-2014, 06:52 PM
bjcowen9000 Re: VBA copy past 02-10-2014, 07:09 PM
Olly Re: VBA copy past 02-10-2014, 07:11 PM
bjcowen9000 Re: VBA copy past 02-10-2014, 06:58 PM
Olly Re: VBA copy past 02-10-2014, 07:01 PM
bjcowen9000 Re: VBA copy past 02-10-2014, 07:22 PM
Richard Buttrey Re: VBA copy past 02-10-2014, 08:52 PM
Olly Re: VBA copy past 02-10-2014, 07:40 PM
  1. #1
    Forum Contributor
    Join Date
    02-13-2013
    Location
    Columbia, SC
    MS-Off Ver
    Excel 2010
    Posts
    217

    VBA copy paste

    How can I copy the cell F36 to Cells in range?

    I have a loop with a lot going on. After calculations, I want to copy cell F36 to cell F15,then add 5 to cell A1, then copy F36 to F16 etc

    Any help?

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VBA copy past

    Range("F36").Copy Range("F15")
    Range("A1").Value = Range("A1").Value + 5
    Not sure how to help with "etc"...
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Contributor
    Join Date
    02-13-2013
    Location
    Columbia, SC
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: VBA copy past

    It is hard to explain. I am trying to minimize differences between cells by changing a cell that they are dependent on. It seems like the accuracy of goal seek decreases as loop continues

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VBA copy past

    Quote Originally Posted by bjcowen9000 View Post
    It is hard to explain.
    It's even harder to understand Especially without seeing your workbook...

  5. #5
    Forum Contributor
    Join Date
    02-13-2013
    Location
    Columbia, SC
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: VBA copy past

    Any ideas why when I do goal seek by setting cell to 0 individually, cell gets set to 0. When I loop, it gets set to a number higher than 0 for different itereations.

    Sub counter()
    Dim step As Integer
    
    Range("k27").Value = 0
    Dim rng As Range, cell As Range
    
    Set rng = Range("F15:F21")
    For Each cell In rng
    
    
        Range("C31").GoalSeek Goal:=0#, ChangingCell:=Range("F36")
        Range("F36").Select
        Selection.Copy
        cell.Value = Range("F36")
    
    Range("k27").Value = Range("k27").Value + 1
    
    Next cell
    
    End Sub

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VBA copy past

    What's the formula in C31?

    What are you trying to achieve?

  7. #7
    Forum Contributor
    Join Date
    02-13-2013
    Location
    Columbia, SC
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: VBA copy past

    Do you see a reason why the goal seeker only fully minimizes the first iteration and not the ones after?

    Sub adf()
    
        Dim iCol        As Long
    
         Range("b32").Value = 5
        For iCol = 6 To 7
            Range("C31").GoalSeek Goal:=0, ChangingCell:=Range("F36")
            Cells(15, iCol).Value = Range("F36").Value
            Range("b32").Value = Range("b32").Value + 5
        Next iCol
    End Sub

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA copy past

    Quote Originally Posted by bjcowen9000 View Post
    Do you see a reason why the goal seeker only fully minimizes the first iteration and not the ones after?
    Why don't you just upload the workbook as requested.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  9. #9
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VBA copy past

    What's the formula in C31?

    (Feel like we're going round in circles, here...)

+ 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. [SOLVED] Copy Paste Loop ends before copy/paste is finished
    By brgr4u in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-08-2013, 04:01 PM
  2. Automate copy and paste and copy and paste back to excel
    By Bmw318be in forum Access Tables & Databases
    Replies: 0
    Last Post: 02-23-2013, 05:42 AM
  3. Replies: 1
    Last Post: 01-16-2013, 05:36 AM
  4. 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
  5. Replies: 1
    Last Post: 01-04-2005, 06:06 PM

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