VBA Code Editing Help Requested

Justinian

Well-known Member
Joined
Aug 9, 2009
Messages
1,557
Office Version
  1. 365
Platform
  1. Windows
Every morning, I copy data from an external source and paste into Excel. This gives me work order information from the previous day except for one problem: I do not need the pasted data in column G. Starting from a blank worksheet, I run this code to paste the data:

Sub Paste_Copied_Data()

Range("A1").Select
ActiveSheet.paste
Range("L18").Select

End Sub


When I then try to remove the pasted data in column G with the following macro, all my data gets deleted instead of just column G:

Sub Macro1()
'
Columns("G:G").Select
Selection.Delete Shift:=xlToLeft

End Sub

How do I paste my data and then have the code delete column G without deleting anything else? What am I doing wrong?
 
Thanks for that.
The problem is that you haven't changed the delete line as I showed in post#13
 
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,223,911
Messages
6,175,331
Members
452,636
Latest member
laura12345

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