Hi,
I am new to VBA & was trying to follow the post shown here.
https://www.ozgrid.com/forum/f…values-in-the-same-column
I got a little confused & now the values dont end up in the correct cells..
Please could you assist me & some information here to help you.
SHEET 1
Month in cell G3
First Value in cell J31
Second Value in cell K31
SHEET 2
Months are in column range C5:C17
First value to be placed in column D
Second value to be placed in column E
So i was expecting this to happen.
Run macro.
Code looks at SHEET 1 in cell G3 & remembers JULY
Code also looks at value in cell J31 of which is £12.34
Code also looks at value in cell K31 of which is 7
Code then looks at SHEET 2 for a match in column C thus JULY.
Once JULY has been found in the cell to the right now column D paste the first value £12.34
I also then require the second value to be placed in the next cell to the right now column E the second value 7
Here is the code i have in use if you can help please.
Have a nice day.
Option Explicit
Private Sub TransferIncomeInfo_Click()
Dim rFndCell As Range
Dim strData As String
Dim stFnd As String
Dim fCol As Integer
Dim sh As Worksheet
Dim ws As Worksheet
Set ws = Sheets("SHEET 1")
Set sh = Sheets("SHEET 2")
stFnd = ws.Range("G3").Value
With sh
Set rFndCell = .Range("C5:C17").Find(stFnd, LookIn:=xlValues)
If Not rFndCell Is Nothing Then
fCol = rFndCell.Column
ws.Range("J31,K31").Copy sh.Cells(6, 4, fCol)
MsgBox "Transfer Has Been Completed", vbInformation + vbOKOnly, "INCOME TRANSFER SHEET MESSAGE"
Else
MsgBox "DOES NOT EXIST"
End If
End With
End Sub
Display More