Wildcard in Macro

andonny

Board Regular
Joined
Mar 11, 2002
Messages
220
Hi,
I like to delete a cell which has a date in it. The date could be anything and I thought maybe if I use a wildcard */02 it might work. The dates are formated as 9/18/02. At the moment I use the macro below but it only works with the text "Date ".

'Sub DelRowInCulumn_A()
Dim RowNum As Integer
Dim LastRow As Integer

With Worksheets("CopiedFromWord")
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
' Move cells to left if 'Date' is found
For RowNum = LastRow To 1 Step -1
If Range("B" & RowNum).Value = "Date " Or Range("B" & RowNum).Value = "*/02" Then
Cells(RowNum, 1).Select
Selection.Delete Shift:=xlToLeft
Cells(RowNum + 1, 1).Select
Selection.Delete Shift:=xlToLeft
End If
Next RowNum
Range("A1").Select
End With
'End Sub

Your help is very much appreciated
Andonny
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Copy this to a Sheet module, Select (Block) Range that you want the code to run on and Run the Macro. JSW

Sub DDate()
'Select Range to test then run Sub.
Set myRange = Selection
For Each C In myRange
If IsDate(C) = True Then
C.ClearContents
End If

Next C
End Sub
 
Upvote 0
Hi,
Thank you for your kind reply.
I just realized that the cell is actually formatted as general and not as Date.

Thanks a million for your help
Andonny
This message was edited by andonny on 2002-09-19 19:46
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,817
Members
449,049
Latest member
cybersurfer5000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top