Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
Option Explicit Private Sub CommandButton1_Click() Dim FullFileName As String FullFileName = Application.GetOpenFilename("Excel files (*.xl*),*.xl*", _ 1, "Custom Dialog Title", , False) Workbooks.Open FullFileName Dim wbOpen As Workbook Set wbOpen = Workbooks.Open(FullFileName) Dim xSheet As Worksheet xSheet = wbOpen.Worksheet 'wrong here Dim m As Integer Dim n As Integer m = xlCellTypeLastRow n = xlCellTypeLastCol With wbOpen Dim X As Long Dim Y As Long X = xlCellTypeLastRow Y = xlCellTypeLastCol Dim i As Integer Dim j As Integer Dim a As Integer Dim b As Integer For i = 1 To X Sheet2.Cells(i, 1) = xSheet(1).Cells(i, 1) Sheet2.Cells(i, 2) = xSheet(1).Cells(i, 2) Sheet2.Cells(i, 3) = xSheet(1).Cells(i, 3) For a = 1 To m If (Sheet1.Cells(a, 3) = xSheet.Cells(i, 1) And Sheet1.Cells(a, 4) = xSheet.Cells(i, 2) And Sheet1.Cells(a, 5) = xSheet.Cells(i, 3)) Then b = a Exit For End If Next a Sheet2.Cells(i, 4) = Sheet1.Cells(a, 1) Sheet2.Cells(i, 5) = Sheet1.Cells(a, 2) Next i End With End Sub Function xlCellTypeLastRow() Dim LastRow As Long With ActiveSheet LastRow = .Range("A1").SpecialCells(xlCellTypeLastCell).Row End With xlCellTypeLastRow = LastRow End Function Function xlCellTypeLastCol() Dim LastCol As Long With ActiveSheet LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column End With xlCellTypeLastCol = LastCol End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.