Copy and Paste - Use next line from same source

emz07

New Member
Joined
Oct 28, 2020
Messages
6
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
hello everyone,

Fairly new to VBA. I'm only using simple macros.

Just wanting some help with a VBA.

I want to copy and paste items from the same cell which I change, into the next line after.

Here's what I use so far. But I don't know how to loop it so it does the next line down. I hope that makes sense.

I want it, so that when I put a new set of information, it moves down a row because previous row has information in it already.

Sub RectangleRoundedCorners1_Click()
Range("J2", "J3").ClearContents
Range("J12", "J13").ClearContents
Range("J10").ClearContents
Range("J1").ClearContents
Range("J1").Value = ("No")
Range("J19").ClearContents
Range("J26").ClearContents
End
 

Attachments

  • Carriage charges JPEG.JPG
    Carriage charges JPEG.JPG
    81.5 KB · Views: 16

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi emz07, welcome to Mr. Excel!

Expect you're after something similar to this:
VBA Code:
Sub RectangleRoundedCorners1_Click()
    Dim rng As Range
    Set rng = Range("V" & Cells(Rows.Count, "V").End(xlUp).Row)
    rng.Offset(1, 0) = [J2]
    rng.Offset(1, 1) = [J3]
    [J1] = ("No")
    [J2,J3,J10,J12,J13,J19,J26].ClearContents
End Sub
 
Upvote 0
Solution
thank you so much this is great! It is exactly as i wanted.
I hope to really get better at writing my own.
I didn’t know I could simplify clearcontents like that:ROFLMAO:

all the best
Emz07
 
Upvote 0
You are welcome and thanks for letting me know.
 
Upvote 0

Forum statistics

Threads
1,214,973
Messages
6,122,534
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top