PDA

View Full Version : Copy text to cell from another sheet



krishak77
03-27-2018, 02:45 PM
Hi EveryOne,

I need a macro coding, Can any body help me for the below requirement.

If i mention AAAA in Sheet2 Cell A2, same should be pick in Sheet1 Cell A2

Regards,
Anantha Krishna

SamT
03-30-2018, 08:02 AM
I don't understand the problem

krishak77
03-31-2018, 11:54 AM
Hi Sam,Thanks for your response.

i need as per below example
in Sheet2
ColumnA, ColumnB, ColumnC
France, Jan, Monday
USA. Feb. Tuesday
UK, Mar, Wednesday

in Sheet1
ColumnD, ColumnE
France, Jan Monday
USA, Feb Tuesday
UK, Mar Wednesday

Regards,
Anantha Krishna

jolivanes
03-31-2018, 08:28 PM
Assumes that you have headers in both sheets.

Sub Maybe()
Dim lr As Long, i As Long, a
lr = Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row
a = Sheets("Sheet2").Range("A2:C" & lr).Value
For i = LBound(a) To UBound(a)
With Sheets("Sheet1").Cells(i + 1, 4)
.Value = a(i, 1)
.Offset(, 1).Value = a(i, 2) & " " & a(i, 3)
End With
Next i
End Sub

krishak77
03-31-2018, 11:04 PM
Hi Jolivanes,

Thanks for your reply, it is exactly what i need, but is it possible to appear data in Sheet1 without click on run macro.

Regards,
Anantha Krishna

mana
03-31-2018, 11:18 PM
Why don't you use formula?

D1:=IF(Sheet2!A1="","",Sheet2!A1)
E1:=IF(Sheet2!A1="","",Sheet2!B1& " " & Sheet2!C1)