Please i want to refer data from multiplesheet.

Pisitju

New Member
Joined
Dec 8, 2020
Messages
20
Office Version
  1. 365
Platform
  1. Windows
I try to use vba code for refer data range"D9" from multisheet to index file (formula in range =VLOOKUP($D$8,'company name'!D4:H319,2,FALSE))
when use code formula in index sheet not same ( =VLOOKUP($D$8,'company name'!#REF!,2,FALSE))

Why code not shown =INV20112601!D9

please help me

thank you.



Sub tgr()
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim wsDest As Worksheet
With Application
.ScreenUpdating = False
.EnableEvents = False
End With

Set wsDest = Sheets("Index")

For Each ws In ActiveWorkbook.Sheets
If ws.Name <> wsDest.Name Then
ActiveSheet.Range("D9").Copy
wsDest.Cells(Rows.Count, "B").End(xlUp).Offset(1).PasteSpecial
End If
Next ws
Application.ScreenUpdating = True
End Sub
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi Pisitju and Welcome to the Board! Not real sure if I understand your question but this seems wrong...
Code:
ws.Range("D9").Copy
Your enable events also has to be returned to true before leaving the sub. HTH. Dave
ps. Please use code tags
 
Upvote 0

Forum statistics

Threads
1,214,545
Messages
6,120,132
Members
448,947
Latest member
test111

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