Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Import/Link Problem 1

Status
Not open for further replies.

Savil

Programmer
Apr 28, 2003
333
EU
Hi All
Im having a problem linking or importing (I don't mind either way) from an excel spreadsheet. one column has mixed text and numbers but it always comes through as a number data type with the text values showing '#NUM'. I have set the column on the sheet to no avail. What can I do?

Thanks
 


Hi,

It's a no-no, mixing text and numbers in the same column!

SOLUTION: Make the Numbers into TEXT STRINGS.

Skip,

[glasses] [red]Be Advised![/red] For those this winter, caught in Arctic-like calamity, be consoled...
Many are cold, but few are frozen![tongue]
 
I hear you but i am assuming this has to be done on the spreadsheet prior to import? Do all the the values need encapsulated in quotes?
 


You could use a procedure like this...
Code:
Sub MakeNumericTextInColumn()
   dim r as range

'first select the column you want to convert

   With Selection
      for each r in range(Cells(2, .Column), Cells(2, .Column).End(xlDown))
        with r
          if isnumeric(.value) then
            .value = "'" & .value
          end if
        end with
      next
   End With
End Sub

Skip,

[glasses] [red]Be Advised![/red] For those this winter, caught in Arctic-like calamity, be consoled...
Many are cold, but few are frozen![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top