SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 65 | Next

Jim DeMarco

"Pro Excel 2007 VBA"


Figure 2-4. View of maillist.csv with Tab selected as delimiter
Select Comma from the Delimiters options. The data preview now shows your data in the
correct columnar display (see Figure 2-5).
Figure 2-5. View of maillist.csv with Comma selected as delimiter
CHAPTER 2 n DATA IN, DATA OUT 49
Click Next to continue to Step 3 of the wizard (see Figure 2-6), where we can choose the
data type for each column of data.
Figure 2-6. Step 3 lets you choose data types for each column.
The onscreen prompt tells us that the General format will convert numeric values to
numbers, date values to dates, and so on. We will choose each column in turn, and choose the
Text data type for our data. The Phone Number column contains numbers, but we want Excel
to treat them as text. The column heading in the ???Data preview??? window shows us the data
type selected for each column.
Click Finish after applying the Text data type to all columns (see Figure 2-7).
Click OK to let Excel place the data beginning in cell A1 (see Figure 2-8).
Click cell A1, and then stop the Macro Recorder. Figure 2-9 shows the data after it has
been imported from the CSV file.
On the Developer ribbon, click the Visual Basic command or press Alt+F11 to open the
Visual Basic window. Let??™s take a look at the code Excel generated for us. We??™ll examine the differences
between importing Access data and text data in the Macro Recorder.
CHAPTER 2 n DATA IN, DATA OUT 50
Figure 2-7. ???Data preview??? window after applying the Text data type to all columns
Figure 2-8.


Pages:
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77