thegreatcorn69
New Member
- Joined
- Aug 7, 2018
- Messages
- 2
Hi There,
I have read a couple of forums on this but am still not getting it right. Lets say I have 2 worksheets. Sheet 1 and Sheet 2.
I would like to have my command button do the following:
1. Cut the selected cell from my existing worksheet (this I have achieved albeit through assistance and not sure if it is correct)
2. Select Sheet 2
3. Find the next available column in Sheet 2
4. Paste the cut field in the sheet
5. As an added bonus I would like to be able to copy the text in another field in Sheet 1 to another adjacent field in Sheet 2.
Here is the code I have so far :
Private Sub CommandButton1_Click()
Dim a As Worksheet
Dim b As Worksheet
Set a = Sheets("Main Pipeline")
Set b = Sheets("Past")
a.Select
Selection.Cut
b.Select
b.Range("A1").End(xlUp).Offset(1, 0).Value = a.Range("a1").Value
End Sub
This code cuts the field but then does not insert it automatically into the next available column in my second sheet. Also - this does obviously not address point 5
Can someone help?
I have read a couple of forums on this but am still not getting it right. Lets say I have 2 worksheets. Sheet 1 and Sheet 2.
I would like to have my command button do the following:
1. Cut the selected cell from my existing worksheet (this I have achieved albeit through assistance and not sure if it is correct)
2. Select Sheet 2
3. Find the next available column in Sheet 2
4. Paste the cut field in the sheet
5. As an added bonus I would like to be able to copy the text in another field in Sheet 1 to another adjacent field in Sheet 2.
Here is the code I have so far :
Private Sub CommandButton1_Click()
Dim a As Worksheet
Dim b As Worksheet
Set a = Sheets("Main Pipeline")
Set b = Sheets("Past")
a.Select
Selection.Cut
b.Select
b.Range("A1").End(xlUp).Offset(1, 0).Value = a.Range("a1").Value
End Sub
This code cuts the field but then does not insert it automatically into the next available column in my second sheet. Also - this does obviously not address point 5
Can someone help?