Hello iv wrote macro in VBA, to copy some data from 1 workbook to another, i need to put this data in end of my "table" in first workbook, and there i have problem. Iv used Columns.Count but this count to much Columns i think. Excel Workload count 5 Rows and 95~~ Columns. if needed i can update for some one both Workloads. Thank There is my code
Sub CopyDataBase()
Dim wb As Workbook
Dim wb2 As Workbook
Dim ws As Worksheet
Dim strFileToOpen As Variant
Dim LastColumn As Range
Dim LastCellColumnNumber As Long
Set wb = ActiveWorkbook
Set ws = Worksheets("CPC1+CPC2 RNI")
Set LastColumn = ws.Cells(1, ws.Columns.Count).End(xlToLeft)
LastCellColumnNumber = LastColumn.Column + 1
strFileToOpen = Application.GetOpenFilename _
(Title:="Please select an Excel file to open", _
FileFilter:="Excel Files *.xlsm (*.xlsm),")
Workbooks.Open Filename:=strFileToOpen
Set wb2 = ActiveWorkbook
wb2.Worksheets("RNI").Range("S2:S4").Select
Selection.Copy
wb.Activate
wb.Worksheets("CPC1+CPC2 RNI").Cells(2 & LastCellColumnNumber).Select
Selection.PasteSpecial Paste:=xlPasteValues
wb2.Close
Set wb = ActiveWorkbook
End Sub