Skip a column in VBA Macro

Maygirl123

New Member
Joined
Dec 16, 2021
Messages
1
Platform
  1. Windows
Hello guys,

I am quite new to VBA world and can't really figure out the code correctly. I have two sheets, Users and Sellers, which are identical, except that Support sheet has a newly added G column, which I want Macro to skip. For now the code before the G column was this:

Range("A5:I100").Select
Selection.Copy
Sheets("Sellers").Select

For X = 1 To 1000

If Range("B4").Offset(X).Value < 1 Then

Range("A4").Offset(X).Select

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False


Sheets("Users").Select

Range("A5:I100").ClearContents


Exit For

End If

How can I tell it to skip G column cause it is pasting the information in that column too. Thank you all for the help!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Welcome to the Forum!

Is this what you're trying to do?

ABCDEFGHI
1
2
3
4
5BlahBlahBlahBlahBlahBlahIGNOREMore blahMore blah
6BlahBlahBlahBlahBlahBlahIGNOREMore blahMore blah
7BlahBlahBlahBlahBlahBlahIGNOREMore blahMore blah
8BlahBlahBlahBlahBlahBlahIGNOREMore blahMore blah
9BlahBlahBlahBlahBlahBlahIGNOREMore blahMore blah
10BlahBlahBlahBlahBlahBlahIGNOREMore blahMore blah
Users

Before:
AB
1Stuff
2Stuff
3Stuff
4Stuff
5Stuff
6Stuff
7Stuff
8Stuff
Sellers

After:
ABCDEFGH
1Stuff
2Stuff
3Stuff
4Stuff
5Stuff
6Stuff
7Stuff
8Stuff
9BlahBlahBlahBlahBlahBlahMore blahMore blah
10BlahBlahBlahBlahBlahBlahMore blahMore blah
11BlahBlahBlahBlahBlahBlahMore blahMore blah
12BlahBlahBlahBlahBlahBlahMore blahMore blah
13BlahBlahBlahBlahBlahBlahMore blahMore blah
14BlahBlahBlahBlahBlahBlahMore blahMore blah
Sellers

VBA Code:
Sub Test()

    Dim ws As Worksheet
    Dim r As Long
    
    Set ws = Worksheets("Sellers")
    r = ws.Range("B" & Rows.count).End(xlUp).Row + 1
    With Worksheets("Users")
        .Range("A5:F100").Copy
        ws.Range("A" & r).PasteSpecial Paste:=xlPasteValues
        .Range("H5:I100").Copy
        ws.Range("G" & r).PasteSpecial Paste:=xlPasteValues
        .Range("A5:I100").ClearContents
    End With
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,032
Messages
6,122,772
Members
449,095
Latest member
m_smith_solihull

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