Is there a way to copy a value in the cell next to target cell?

ArnMan

Board Regular
Joined
Aug 30, 2017
Messages
64
Hello, I have a small script and it works for what it is designed for

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If Not Intersect(Target, Range("G1:G600")) Is Nothing Then
        Target.Copy
    End If
End Sub
Basically it does is monitor G column and when I click anywhere in the G column it will take that cells value and copy it into the clipboard. Then I can paste into Putty. Keeps from having to continually type commands over and over.
Some commands require a number of some sorts to go along with it.
Example G10 Value is Gain_adj and I type in H10 25
I would like to click in G10 and get the value of G10 and H10

Gain_adj 25
Not every cell in H column will have a value that I type in.

Is there something I can change to accomplish this?

Thank you very much
 

Some videos you may like

Excel Facts

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

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
53,425
Office Version
365
Platform
Windows
So if you want to copy columns G and H in that row when you select a cell in column G, try:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("G1:G600")) Is Nothing Then
        Target.Resize(1, 2).Copy
    End If
End Sub
 

ArnMan

Board Regular
Joined
Aug 30, 2017
Messages
64
So if you want to copy columns G and H in that row when you select a cell in column G, try:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("G1:G600")) Is Nothing Then
        Target.Resize(1, 2).Copy
    End If
End Sub
Thank you very much, I think it will work for what I am looking for.

Thank you very much for all your help
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
53,425
Office Version
365
Platform
Windows
You are welcome.
 

Watch MrExcel Video

Forum statistics

Threads
1,099,259
Messages
5,467,624
Members
406,545
Latest member
puneet829

This Week's Hot Topics

Top