Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have been given some code that should worl to get information from five
standardised docs till a new similar doc. However, as the code given is not perfectly fitted to my doc I have trouble in getting the code work for me. The code is (this is not all data for the process but only the data that does not work: private Sub GetData(LsWorkbook As String) Dim LrDestRange As Range Dim LrSourceRange As Range Dim LlCounter As Long Dim LwkbkSource As Workbook Dim LrRange As Range Dim LsFileFolder As String ' First Check that the format of the data is correct With LwkbkSource.Sheets(1) Set LrSourceRange = .Range(.Range("A1"), .Range("A1").End(xlToRight)) End With For Each LrRange In SData.Range("Headings") If LrRange.Offset(-1, 0).Value = "Check" Then If Not LrSourceRange.Cells(LrRange.Column).Value = LrRange.Value Then MsgBox "Source data is missing column " & LrRange.Column & ", value = " & LrRange.Value End End If End If Next ' Passed the checks so paste in the data Set LrDestRange = SData.Range("A1").End(xlDown).Offset(1, 0) With LwkbkSource.Sheets(1) Set LrSourceRange = .Range(.Range("A2"), ..Range("A2").End(xlDown).Offset(0, SData.Range("Headings").Columns.Count)) End With LrDestRange.Resize(LrSourceRange.Rows.Count, LrSourceRange.Columns.Count).Value = LrSourceRange.Value LrDestRange.Offset(0, LrSourceRange.Columns.Count - 1).Resize(LrSourceRange.Rows.Count, 1).Value = LsWorkbook LwkbkSource.Close Exit Sub So what I want to be able to do is to get my five tabs with information, A,B,C,D,E to get copied and pasted in the new document below eachother. The new document is called X. The thing is that the array I want to copy is from c6:O6 and all the way down until the last row which can fluctuate. So as I see it the code must be changed for that as well... What other things must I do to get it to work??? for example With LwkbkSource.Sheets(1) what does that mean, must I change Sheets(1) for something??? I would like to keep as close to the original codeas possible, but could anyone see and tell me what changes I need to do???? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Determine and interpret the P-Value | Excel Discussion (Misc queries) | |||
How does VBA interpret Dates? | Excel Programming | |||
Interpret code | Excel Programming | |||
Why does Excel interpret 2/29 as Feb 1st? | Excel Discussion (Misc queries) | |||
Could some one please help me to interpret the following syntax | Excel Programming |