motabrasil
New Member
- Joined
- May 11, 2010
- Messages
- 28
Hey fellows,
I have the code described that basically capture a sheet from another workbook and paste in the active workbook.
However, the problem I'm facing is, for each column the code only import the majority data (between TEXT or NUMBER) for each column.
For example, if in the column "C", we have 70% of the contents are NUMBERS and the others 30% are TEXT, the code will import only the 70% of NUMBERS. Not even the column header is imported.
Anyone know how to fix that?
Thank you!!!
Private Sub OptBOMYes_Click()<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" /><o
></o
>
Dim SaveDriveDir As String, MyPath As String<o
></o
>
Dim FName As Variant<o
></o
>
Dim J As Long, X As Long, Y As Long, K As Long<o
></o
>
Dim LastColumn As Long, LastRow As Long<o
></o
>
Dim wsBOM As Worksheet<o
></o
>
<o
></o
>
SaveDriveDir = CurDir<o
></o
>
MyPath = Application.DefaultFilePath<o
></o
>
ChDrive MyPath<o
></o
>
ChDir MyPath<o
></o
>
FName = Application.GetOpenFilename(filefilter:="Excel Files, *.xlsx*")<o
></o
>
<o
></o
>
If FName = False Then<o
></o
>
'do nothing<o
></o
>
Else<o
></o
>
GetData FName, "CBOM", "A2:BB1000", Sheets("BOM").Range("B2"), False, False<o
></o
>
End If<o
></o
>
<o
></o
>
ChDrive SaveDriveDir<o
></o
>
ChDir SaveDriveDir<o
></o
>
<o
></o
>
MsgBox "Done!!!"<o
></o
>
Unload Me<o
></o
>
End Sub
I have the code described that basically capture a sheet from another workbook and paste in the active workbook.
However, the problem I'm facing is, for each column the code only import the majority data (between TEXT or NUMBER) for each column.
For example, if in the column "C", we have 70% of the contents are NUMBERS and the others 30% are TEXT, the code will import only the 70% of NUMBERS. Not even the column header is imported.
Anyone know how to fix that?
Thank you!!!
Private Sub OptBOMYes_Click()<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
Dim SaveDriveDir As String, MyPath As String<o
Dim FName As Variant<o
Dim J As Long, X As Long, Y As Long, K As Long<o
Dim LastColumn As Long, LastRow As Long<o
Dim wsBOM As Worksheet<o
<o
SaveDriveDir = CurDir<o
MyPath = Application.DefaultFilePath<o
ChDrive MyPath<o
ChDir MyPath<o
FName = Application.GetOpenFilename(filefilter:="Excel Files, *.xlsx*")<o
<o
If FName = False Then<o
'do nothing<o
Else<o
GetData FName, "CBOM", "A2:BB1000", Sheets("BOM").Range("B2"), False, False<o
End If<o
<o
ChDrive SaveDriveDir<o
ChDir SaveDriveDir<o
<o
MsgBox "Done!!!"<o
Unload Me<o
End Sub