Hey guys,
When you want to write some value in an excel file from MATLAB, you can use:
my_string = 'test';
xlswrite('my_excel.xls', {my_string}, 'my_page', 'A1');
where,
my_excel.xls: file I need to write
{my_string}: the content
{} of my_string makes sure the whole string is written in one cell.
my_page: the page of the escel file
A1: the cell
Thursday, July 26, 2012
Sunday, July 1, 2012
MS Excel: Get rid of rows that contain a particular string
Hey guys,
This is how it is done. We make use of macros to achieve this.
This is how it is done. We make use of macros to achieve this.
- If the developer tab is not visible make it visible as follows: (MS Excel 2007)
- Click the office button
- Then, click the Excel Options button
- Choose "Popular" tab
- In "Top option for working with Excel", tick the "Show developer tab in the Ribbon"
- Now go to the developer tab and click on the visual basic button.
- Double click on the sheet1(sheet1)...or the sheet you want the macro to run
- Now enter this code:
- Replace MyString with the string you want to search
Sub DoIt()
Dim Sentences
Dim i As Long
Dim iWordPos As Integer
Sentences = Range("A1", Range("A65536").End(xlUp))
lRow = 0
For i = Range("A65536").End(xlUp).Row To 1 Step -1
iWordPos = InStr(LCase(Sentences(i, 1)), LCase("MyString"))
If iWordPos > 0 Then
Range("A" & i).EntireRow.Delete shift:=xlShiftUp
End If
Next i
End Sub
'Comment : Range("A65536").End(xlUp) is the final cell
Subscribe to:
Posts (Atom)