Copy and Paste - Use next line from same source

emz07

New Member
Joined
Oct 28, 2020
Messages
2
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: 8

Some videos you may like

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

GWteB

Well-known Member
Joined
Sep 10, 2010
Messages
1,295
Office Version
  1. 2013
Platform
  1. Windows
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
 
Solution

emz07

New Member
Joined
Oct 28, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
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
 

GWteB

Well-known Member
Joined
Sep 10, 2010
Messages
1,295
Office Version
  1. 2013
Platform
  1. Windows
You are welcome and thanks for letting me know.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,585
Messages
5,625,656
Members
416,124
Latest member
DeMoNloK

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
Top