Check column and copy if it is the same - excel

I have numbers in the Range G2:G10, I have to check if these numbers are in one of the Cells in the Row B of the second file. Now I just have a true if argument when the same number is in G2(File 1) and B2(File 2). But how can I do this, so that when G2(File 1) and B4(File 2) are the same the if also works?
Dim cell As Range
Dim wb1 As Workbook, ws1 As Worksheet
Dim wb2 As Workbook, ws2 As Worksheet
Set wb1 = Application.Workbooks.Open("T:\folder\Map2.xlsm")
Set ws1 = wb1.Sheets("Tabelle1")
Set wb2 = Application.Workbooks.Open("T:\folder\file.xlsx")
Set ws2 = wb2.Sheets("sheet1")
For Each cell In wb1.Sheets(1).Range("G2:G10")
If cell.Value = ws2.Cells(cell.Row, "B").Value Then
ws2.Cells(cell.Row, "D").Resize(1, 3).Select
End If
Next cell
End Sub

Try this
Sub test()
Dim c As Range, cx As Range, str$
Dim wb1 As Workbook, ws1 As Worksheet
Dim wb2 As Workbook, ws2 As Worksheet
Set wb1 = Application.Workbooks.Open("T:\folder\Map2.xlsm")
Set ws1 = wb1.Sheets("Tabelle1")
Set wb2 = Application.Workbooks.Open("T:\folder\file.xlsx")
Set ws2 = wb2.Sheets("sheet1")
For Each c In ws1.Range(ws1.Cells(1, 7), ws1.Cells(ws1.Rows.Count, 7).End(xlUp))
For Each cx In ws2.Range(ws2.Cells(1, 2), ws2.Cells(ws2.Rows.Count, 2).End(xlUp))
If c = cx Then
cx.Offset(, 2).Resize(1, 3).Select
str = str & ", " & cx.Address
'Msgbox cx.Address
End If
Next cx
Next c
Msgbox "The following cells meet the conditions: " & Replace(str, ",", "", 1, 1)
End Sub

This uses a dictionary and does what I think you are looking for. Though I might have your sheets backwards. I tested using a single workbook and just added in your workbook and sheet values. I am also unsure what you want to do when a value is found so I left that blank.
Sub compare()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim cell As Range
Dim lastrow As Long
Dim dict As Object
Set wb1 = Application.Workbooks.Open("T:\folder\Map2.xlsm")
Set ws1 = wb1.Sheets("Tabelle1")
Set wb2 = Application.Workbooks.Open("T:\folder\file.xlsx")
Set ws2 = wb2.Sheets("sheet1")
Set dict = CreateObject("Scripting.Dictionary") 'This is late bound you can change to early binding if you want
With ws2
lastrow = .Cells(.Rows.Count, 2).End(xlUp).Row
For Each cell In .Range("B1:B" & lastrow)
If Not dict.exists(cell.Value) Then 'Avoid errors
dict.Add cell.Value,cell 'Add key value, item will be the range
End If
Next cell
End With
With ws1
For Each cell In Range("G2:G10")
If dict.exists(cell.Value) Then 'Duplicate found when true
'Here we take the matched range offset and place it in the new offset range
Range(cell.Offset(0, 2), cell.Offset(0, 4)).Value = Range(dict(cell.Value).Offset(0, 2), dict(cell.Value).Offset(0, 4)).Value
End If
Next cell
End With
End Sub

Related

Get the respective values of the latest closing date

As you see on the above picture:
I need to match the values on Wb1.coumns(1) with the other workbook Wb2.coumns(1) with some conditions.
Wb2 will be filtered of the value Close at column M.
Then I seek the latest closing date and get it’s respective value at column B and input that value in Wb1.column(K).
the below code may work on the provided example correctly, But it is not reliable on my actual dataset,
because it depends on the sort of many columns from oldest to newest.
This is a link for the provided sample
Sub Get_the_respective_value_of_Last_Closing_Date()
Dim wb1 As Workbook, wb2 As Workbook
Dim ws1 As Worksheet, ws2 As Worksheet
Dim rng1 As Range, rng2 As Range
Dim arr1() As Variant, arr2() As Variant
Application.ScreenUpdating = False
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("Path of wb2", UpdateLinks:=False, ReadOnly:=True)
Set ws1 = wb1.Sheets(1)
Set ws2 = wb2.Sheets(1)
Set rng1 = ws1.Range("A3:K" & ws1.Cells(ws1.Rows.Count, "A").End(xlUp).Row) 'Main Range
Set rng2 = ws2.Range("A3:M" & ws2.Cells(ws2.Rows.Count, "A").End(xlUp).Row)
arr1 = rng1.Value2
arr2 = rng2.Value2
Dim i As Long, k As Long
For i = LBound(arr1) To UBound(arr1)
For k = LBound(arr2) To UBound(arr2)
If arr1(i, 1) = arr2(k, 1) And arr2(k, 13) = "Close" Then
rng1.Cells(i, 11) = arr2(k, 2)
End If
Next k
Next i
wb2.Close SaveChanges:=False
Application.ScreenUpdating = True
End Sub
Please, try the next adapted code. It uses a dictionary, to keep the unique kay (and last value from "K:K" as item) of the opened Workbook, then placing the appropriate data in the working workbook:
Sub Get_Last_Closing_Date()
Dim wb1 As Workbook, wb2 As Workbook
Dim ws1 As Worksheet, ws2 As Worksheet
Dim rng1 As Range, rng2 As Range
Dim arr1() As Variant, arr2() As Variant
Dim dict As Object
Application.ScreenUpdating = False
Set wb1 = ThisWorkbook
'Please, update the real path of "Book2.xlsx":
Set wb2 = Workbooks.Open(ThisWorkbook.Path & "\Book2.xlsx", UpdateLinks:=False, ReadOnly:=True)
Set ws1 = wb1.Sheets(1)
Set ws2 = wb2.Sheets(1)
Set rng1 = ws1.Range("A3:K" & ws1.Cells(ws1.Rows.Count, "A").End(xlUp).Row) 'Main Range
Set rng2 = ws2.Range("A3:M" & ws2.Cells(ws2.Rows.Count, "A").End(xlUp).Row)
arr1 = rng1.Value2
arr2 = rng2.Value2
'place the unique last key in a dictionary:
Dim i As Long
Set dict = CreateObject("Scripting.dictionary")
For i = 1 To UBound(arr2)
If arr2(i, 13) = "Close" Then
dict(arr2(i, 1)) = arr2(i, 2)
End If
Next i
Debug.Print Join(dict.items, "|") 'just to visualy see the result
'Place the necessary data in its place:
For i = 1 To UBound(arr1)
If dict.Exists(arr1(i, 1)) Then
arr1(i, 11) = dict(arr1(i, 1))
Else
arr1(i, 11) = "NA"
End If
Next i
rng1.Value2 = arr1 'drop back the updated array content
wb2.Close SaveChanges:=False
Application.ScreenUpdating = True
MsgBox "Ready..."
End Sub
Column "K:K" of the workbook to be opened must be sorted ascending...
Edited:
The next version works without needing to have column "K:K" sorted:
Sub Get_Last_Closing_Date()
Dim wb1 As Workbook, wb2 As Workbook
Dim ws1 As Worksheet, ws2 As Worksheet
Dim rng1 As Range, rng2 As Range
Dim arr1() As Variant, arr2() As Variant
Dim dict As Object
Application.ScreenUpdating = False
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open(ThisWorkbook.Path & "\Book2.xlsx", UpdateLinks:=False, ReadOnly:=True)
Set ws1 = wb1.Sheets(1)
Set ws2 = wb2.Sheets(1)
Set rng1 = ws1.Range("A3:K" & ws1.Cells(ws1.Rows.Count, "A").End(xlUp).Row) 'Main Range
Set rng2 = ws2.Range("A3:M" & ws2.Cells(ws2.Rows.Count, "A").End(xlUp).Row)
arr1 = rng1.Value2
arr2 = rng2.Value2
'place the unique last key in a dictionary:
Dim i As Long
Set dict = CreateObject("Scripting.dictionary")
For i = 1 To UBound(arr2)
If arr2(i, 13) = "Close" Then
If Not dict.Exists(arr2(i, 1)) Then
dict(arr2(i, 1)) = Array(arr2(i, 2), arr2(i, 11)) 'place the date from K:K, too
Else
If CDate(arr2(i, 11)) > CDate(dict(arr2(i, 1))(1)) Then 'change the item only in case of a more recent date:
dict(arr2(i, 1)) = Array(arr2(i, 2), arr2(i, 11))
End If
End If
End If
Next i
'Place the necessary data in its place:
For i = 1 To UBound(arr1)
If dict.Exists(arr1(i, 1)) Then
arr1(i, 11) = dict(arr1(i, 1))(0) 'extract first item array element
Else
arr1(i, 11) = "NA"
End If
Next i
rng1.Value2 = arr1 'drop back the updated array content
wb2.Close SaveChanges:=False
Application.ScreenUpdating = True
MsgBox "Ready..."
End Sub
You may benefit from functions in Excel and combine them with Evaluate trough VBA. Just as example I made up this:
I made up this in same worksheet just as explanation. The formula to get this in column K is:
=IFERROR(INDEX($N$2:$N$16,SUMPRODUCT(--($W$2:$W$16=MAX(--($Y$2:$Y$16="Close")*--($M$2:$M$16=A2)*$W$2:$W$16))*ROW($M$2:$M$16))-1),"NA")
This formula will return desired output. Applied to VBA would be:
Sub Get_Last_Closing_Date()
Dim wb1 As Workbook, wb2 As Workbook
Dim ws1 As Worksheet, ws2 As Worksheet
Dim rng2 As Range
Dim i As Long
Dim MyFormula As String
Application.ScreenUpdating = False
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("D:\Users\gaballahw\Desktop\Book2.xlsx", UpdateLinks:=False, ReadOnly:=True)
Set ws1 = wb1.Sheets(1)
Set ws2 = wb2.Sheets(1)
Set rng2 = ws2.Range("A3:M" & ws2.Cells(ws2.Rows.Count, "A").End(xlUp).Row)
With ws1
For i = 3 To ws1.Cells(ws1.Rows.Count, "A").End(xlUp).Row Step 1
MyFormula = "IFERROR(INDEX(" & rng2.Columns(2).Address & ",SUMPRODUCT(--(" & rng2.Columns(11).Address & _
"=MAX(--(" & rng2.Columns(13).Address & "=""Close"")*--(" & rng2.Columns(1).Address & _
"=" & .Range("A" & i).Value & ")*" & rng2.Columns(11).Address & "))*ROW(" & rng2.Columns(1).Address & "))-2),""NA"")" '-2 because data starts at row 3
.Range("K" & i).Value = Evaluate(MyFormula)
Next i
End With
wb2.Close SaveChanges:=False
Set rng2 = Nothing
Set ws1 = Nothing
Set ws2 = Nothing
Set wb1 = Nothing
Set wb2 = Nothing
Application.ScreenUpdating = True
End Sub
Also, if you have Excel365 you may benefit from function MAXIFS:
MAXIFS function
I'm pretty sure that in the formula provided the part --($W$2:$W$16=MAX(--($Y$2:$Y$16="Close")*--($M$2:$M$16=A2)*$W$2:$W$16)) could be replaced with a MAXIFS but i got an older version of Excel so I can't test.
Also, check Evaluate:
Application.Evaluate method
(Excel)
SORT And XLOOKUP to Get Maximums
In Microsoft 365, you could use the following spilling formula in cell K3 of Sheet1:
=LET(sArray,Sheet2!A3:M22,sFilterCol,13,sCriteria,"Closed",sSortCols,{11;1},sSortOrders,{-1;1},sLookupCol,1,sReturnCol,2,
dLookup,A3:A14,dNotFound,"NA",
sSorted,SORT(FILTER(sArray,CHOOSECOLS(sArray,sFilterCol)=sCriteria),sSortCols,sSortOrders),
sLookup,CHOOSECOLS(sSorted,sLookupCol),sReturn,CHOOSECOLS(sSorted,sReturnCol),
XLOOKUP(dLookup,sLookup,sReturn,dNotFound))
The 1st row holds the source constants (7) while the 2nd row the destination constants (2).
The 3rd row returns the source array filtered and sorted.
In the 4th row this modified array is used to get the source lookup and return columns.
These columns, along with the destination constants, are then fed to the XLOOKUP function in the 5th row.
Edit
For this to work with your test files, with Book2.xlsx open, you need to replace Sheet2!A3:M22 with '[Book2.xlsx]Wb2-sh1'!A3:M18, A3:A14 with A3:A8 and Closed with Close (my bad).

Loop Through column and copy values to other sheet when values are not zero vba excel

I need to write a macro that loops over a column (lets say A) in the last worksheet of the worbook and copies the values in the cell into the same position (so if the first value is in A1, also A1) in another worksheet if they are not 0. I already managed to write some code but I am struggling with setting the range for the range that I am looping for. Help is much appreciated.
Sub tableonlycopywhen0()
Dim Cell As Range, cRange As Range
Dim wsDestination As Worksheet, wsSource As Worksheet
'set worksheets
With ThisWorkbook
Set wsSource = .Worksheets(Sheets.Count)
Set wsDestination = .Worksheets("Overview")
End With
LastRow1 = Sheets(Sheets.Count).Cells(Rows.Count, "A").End(xlUp).Row
Set cRange = Sheets(Sheets.Count).Range(Sheets(Sheets.Count).Cells("A1:A" & LastRow1))
For Each Cell In cRange
If Cell.Value > 0 Then
Cell.Copy
Sheets("Overview").Select
lastRow = wsDestination.Cells(wsDestination.Rows.Count, "A").End(xlUp).Row + 1
wsDestination.Rows(lastRow).PasteSpecial Paste:=xlPasteValues
End If
Next Cell
End Sub
You have already established wsSource, no need to repeat it. Also no need to copy, select and paste when you can make the cells equal.
Sub tableonlycopywhen0()
Dim Cell As Range, cRange As Range
Dim wsDestination As Worksheet, wsSource As Worksheet
'set worksheets
With ThisWorkbook
Set wsSource = .Worksheets(Sheets.Count)
Set wsDestination = .Worksheets("Overview")
End With
LastRow1 = wsSource.Cells(Rows.Count, "A").End(xlUp).Row
Set cRange = wsSource.Range(wsSource.Cells(1,1),wsSource.Cells(LastRow1,1))
For Each Cell In cRange
If Cell.Value > 0 Then
lastRow = wsDestination.Cells(wsDestination.Rows.Count, "A").End(xlUp).Row + 1
wsDestination.Cells(lastRow,1)=Cell.Value
End If
Next Cell
End Sub
you wrote: and copies the values in the cell into the same position
this code run as you ask:
Sub tableonlycopywhen1()
Dim Cell As Range, cRange As Range, lrw As Long
Dim wsDestination As Worksheet, wsSource As Worksheet
'set worksheets
With ThisWorkbook
Set wsSource = .Worksheets(Sheets.Count)
Set wsDestination = .Worksheets("Overview")
End With
LastRow1 = wsSource.Cells(Rows.Count, "A").End(xlUp).Row
Set cRange = wsSource.Range(wsSource.Cells(1, 1), wsSource.Cells(LastRow1, 1))
For Each Cell In cRange.Cells
If Cell.Value > 0 Then wsDestination.Cells(Cell.Row, Cell.Column) = Cell.Value
Next Cell
End Sub

Why am I receiving "object does not support this property method"?

I have information in a whole lot of worksheets in workbook Wb1 and this information is always in range F11:F500 I want to transfer this information into one sheet in workbook wb in column A. See code below. I receive the error
at this line rng2.Paste
Option Explicit
Sub NameRisk()
' Copy and paste
Dim wb1 As Workbook
Dim wb As Workbook
Dim ws As Worksheet
Dim ws1 As Worksheet
Dim rng As Range
Dim c As Range
Dim lastrow As Long
Dim rng2 As Range
Set wb1 = Application.Workbooks("COMBINED ADD.xls")
Set wb = Application.Workbooks("NameRiskXtract.xlsm")
Set ws = wb.Worksheets("Sheet1")
For Each ws1 In wb1.Sheets
Set rng = Range("F11:F500")
For Each c In rng
If c.Value <> "" Then
c.Copy
With ws
lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
Set rng2 = ws.Range("A" & lastrow)
rng2.Paste
End With
End If
Next c
Next ws1
End Sub
Range("F11:F500") should have a parent worksheet; I'm guessing it is ws1. You may be cancelling the Copy operation. Better to Copy with a destination.
...
For Each ws1 In wb1.Sheets
Set rng = ws1.Range("F11:F500")
For Each c In rng
If c.Value <> "" Then
c.Copy destination:=ws.Cells(ws.Rows.Count, "A").End(xlUp).offset(1, 0)
End If
Next c
Next ws
...
You are still in your with statement. try:
For Each ws1 In wb1.Sheets
Set rng = Range("F11:F500")
For Each c In rng
If c.Value <> "" Then
c.Copy
With ws
lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
Set rng2 = .Range("A" & lastrow) " <--- removed ws
rng2.Paste
End With
End If
Next c
Next ws1
You may also want to avoid copy/paste entirely and use this snippet instead:
For Each ws1 In wb1.Sheets
For Each c In ws1.Range("F11:F500")
If c.Value <> "" Then ws.Range("A" & ws.Cells(.Rows.Count, "A").End(xlUp).Row + 1).value = c.value
Next c
Next ws1

Change from interface to Cell, specify range

currently the code below will copy two spreadsheets into the macro sheet.
Problem: I want to use Excel cells to specify a file path (from cell A1, A2 or wherever), a sheet name (from cell B1, B2), and a corresponding specified cell range (in cells C1, C2) instead of having to browse to each file with the Application.
Option Explicit
Sub Sample()
Dim wb1 As Workbook: Set wb1 = ThisWorkbook
Dim wb2 As Workbook
Dim i As Long
Dim wsNew As Worksheet
Dim ws As Worksheet: Set ws = wb1.Sheets("Sheet1")
Dim LastRow
Dim sheetName As String
Dim rangeStart As String
Dim rangeEnd As String
Dim ws2 As Worksheet
Dim CellValueToCopy As String
'declare and set your worksheet with your filenames
LastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
'get the last row with data by finding the last item in Column A
For i = 2 To LastRow 'loop from Row 2 to Last in Sheet1 of this workbook
Set wb2 = Workbooks.Open(ws.Cells(i, "A")) 'open the file stored in Column A of Sheet1 of this workbook
sheetName = ws.Cells(i, "B")
rangeStart = ws.Cells(i, "C")
rangeEnd = ws.Cells(i, "D")
'wb2.Sheets(ws.Cells(i, "B").Value).range(ws.Cells(i, "C").Value).Copy
Set ws2 = wb2.Worksheets(sheetName)
wb1.Sheets.Add
wb1.ActiveSheet.Name = sheetName + "_added"
' the below is a proof of concept to copy the values
' loop through the range rather than just one cell to get the final copy
CellValueToCopy = ws2.Cells(1, 1)
wb1.ActiveSheet.Cells(1, 1) = CellValueToCopy
' close workbook and reset variables
wb2.Close SaveChanges:=False
Set wb2 = Nothing
Set wsNew = Nothing
Set ws2 = Nothing
Next i
End Sub
How about something like the following, this will loop through your column A, open the given filename, and copy the Range from Column C from the Sheet in Column B and paste into a new sheet in the current workbook:
Option Explicit
Sub Sample()
Dim wb1 As Workbook: Set wb1 = Workbooks("Change from interface to Cell specify range.xlsm")
Dim wb2 As Workbook
Dim i As Long, LastRow As Long
Dim wsNew As Worksheet
Dim ws As Worksheet: Set ws = wb1.Sheets("Sheet1")
'declare and set your worksheet with your filenames, amend as required
LastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
'get the last row with data on Column A
For i = 2 To LastRow 'loop from Row 2 to Last in Sheet1 of this workbook
Set wb2 = Workbooks.Open(ws.Cells(i, "A")) 'open the file stored in Column A of Sheet1 of this workbook
wb2.Sheets(ws.Cells(i, "B").Value).Range(ws.Cells(i, "C").Value).Copy
'above specify the sheet from Column B of Sheet1 and the Range from Column C
'if you have starting range at Column C and end range at Column D then the line below will copy the specified range
'wb2.Sheets(ws.Cells(i, "B").Value).Range(ws.Cells(i, "C").Value & ":" & ws.Cells(i, "D").Value).Copy
Set wsNew = wb1.Sheets.Add(After:=wb1.Sheets(wb1.Sheets.Count))
wsNew.Name = "Blah Blah " & (i - 1)
'above add a new sheet and name accordingly, I used the counter i to number the sheets
wsNew.Range("A1").PasteSpecial xlPasteAll
wb2.Close SaveChanges:=False
Set wb2 = Nothing
Set wsNew = Nothing
Next i
End Sub

Looking Up Values in Separate Workbook and Copying Data to This Workbook

I've been working on this one for a couple weeks now and I can't seem to get it right. The concept seems easy which is why I'm so frustrated with it. I finally resorted to posting here for some input.
The idea behind this is similar to a vlookup (I tried vlookup and got a result I wasn't looking for). On ThisWorkbook, I set "Desc" equal to cell B7. I then want to look this up in a separate workbook which is the database. Once "Desc" is found in the database, I want to copy the data in column D and paste it to the cell to the right of "Desc" in the original workbook. I need to repeat the Copy-Paste process for the rest of the cells in column B under "Desc". Thanks in advance. Cheers.
Option Explicit
Dim i As Integer, n As Integer
Dim Desc As Range, ExDesc As Range
Dim wb1 As Workbook, wb2 As Workbook
Dim ws1 As Worksheet, ws2 As Worksheet
Sub Retrieve()
Application.ScreenUpdating = False
Set wb1 = ThisWorkbook
Set ws1 = wb1.Sheets("Import")
ws1.Range("C7:C100000").ClearContents
With ws1
i = 7
Do Until .Cells(i, 2) = ""
Set Desc = ws1.Cells(i, 2)
With Workbooks.Open("C:\Users\Username\Desktop\Database.xlsm")
Set wb2 = ActiveWorkbook
Set ws2 = wb2.Sheets("Data")
n = 2
Do Until ws2.Cells(n, 2) = ""
Set ExDesc = Cells(n, 2)
If ExDesc = Desc Then
ExDesc.Offset(0,2).Copy
End If
n = n + 1
Loop
End With
i = i + 1
Loop
End With
End Sub
Public Sub Paste()
wb1.Activate
ws1.Cells(i, 3).Paste
End Sub
Untested:
Sub Retrieve()
Dim i As Integer, n As Integer
Dim Desc As Range, ExDesc As Range
Dim wb1 As Workbook, wb2 As Workbook
Dim ws1 As Worksheet, ws2 As Worksheet
Dim rngLookup As Range
Dim v
Application.ScreenUpdating = False
Set wb1 = ThisWorkbook
Set ws1 = wb1.Sheets("Import")
ws1.Range("C7:C100000").ClearContents
Set wb2 = Workbooks.Open("C:\Users\Username\Desktop\Database.xlsm")
With wb2.Sheets("Data")
Set rngLookup = .Range(.Cells(7, 2), _
.Cells(7, 2).End(xlDown)).Resize(, 3)
End With
With ws1
i = 7
Do Until .Cells(i, 2) = ""
v = Application.VLookup(.Cells(i, 2).Value, rngLookup, 3, False)
If Not IsError(v) Then .Cells(i, 4).Value = v
i = i + 1
Loop
End With
wb2.Close False
End Sub
Try this:
Sub Retrieve()
Application.ScreenUpdating = False
Dim lookuprng As Range
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("C:\Users\username\Desktop\Database.xlsm")
Set lookuprng = wb2.Sheets("Data").Range("look up range in Database")
Set ws1 = wb1.Sheets("Import")
ws1.Range("C7:C100000").ClearContents
wb1.Activate
With ws1
i = 7
Do Until .Cells(i, 2) = ""
Cells(i, 5).Value = Application.VLookup(Cells(i, 2).Value, lookuprng, 2, 0)
i = i + 1
Loop
End With
End Sub
You mentioned I tried vlookup and got a result I wasn't looking for but this should work, though you would have to update links if the sheet with the lookup table is not open in the same session.

Resources