Search This Blog

Showing posts with label Microsoft Excel 2003. Show all posts
Showing posts with label Microsoft Excel 2003. Show all posts

Monday, August 29, 2011

How to link data in 2 excel files and combine them into 1 using macro?

FILE 1
data: Column A, B and C

FILE 2
data: Column A, and D

Use FILE 1 as the primary file.

Final Result: should have A , B C and D together in 1 spreadsheet.

Problem : Look up function but seems like it doesn't work well. the data is jumble up. I still to check using True false function. cos what is avai in A may not be found in B. 



Pri file has more information ( in terms of number of names ) than file 2.
name      data1       data2      data3

and in file 2:
name      data1       data2      data3  data4
 


Sunday, August 28, 2011

Macro - ADD 3 rows & UNDO Macro to undo the addition of 3 rows

To do the following :

a) ADD 3 Rows
 (or even more rows) by prompting user to enter the number of rows they wish to insert.


b) UNDO MACRO:

1. Undo the addition/insertion of rows 


2. when click, it will also prompt: "Do you want to undo adding 3 rows ?" 

> Yes | Cancel
if Yes, macro proceed and if Cancel , macro will not run and remain.




Friday, August 26, 2011

Create a macro to convert multiple .txt file and place all data from text to .xls file

  1. Convert multiple .txt files in a folder
  2. Delimit the .txt files so that there are headers in each column
  3. Format for date (1st column) should be in DD-MM-YY format
  4. Place all data from .txt files into 1 .xls file
  5. Scan through the data in .xls file
  6. Ensure all data are unique (ie. no repeated data in each row)

Wednesday, August 24, 2011

Comparing sets of data (lower and upper limit)

Data set:
0.5, 1.5, 2.1, 0.43, 0.35

condition/base number : 1

Result needed:
To select number nearest to 1 ie.= 0.5 by using macro.

Note: Although 1.5 is also near to 1 (also a 0.5 difference), it must choose the smaller number.
(0.5 is smaller as compared to 1.5) 



Thursday, August 18, 2011

How do I extract selected text from a string of text?

Data in a cell and need to extract part of it :


Examples:
1. AERO 030405A AUTO 24567AZ 99AM  > Extract 67
2. AERO 030405Z AUTO 25611C22AZ 99BM >  Extract 11 




Sunday, August 15, 2010

How to delete unwanted columns via macro for data analysis


1. Place 'X' in Row 2 in whichever columns you would like to delete.

2. Paste the following macro in Module.
(Insert > Module)


Sub del_columns()
Dim ws As Worksheet
Dim lastcolm As Long
Dim i As Long
For Each ws In Worksheets
With ws
lastcolm = .Cells(2, .Cells.Columns.Count).End(xlToLeft).Column
For i = lastcolm To 1 Step -1
If UCase(.Cells(2, i)) = "X" Then
.Columns(i).Delete
End If
Next i
End With
Next ws
End Sub

3. Press Alt+F8.

4. Click Run .