VBA - Using asterisks when searching for number

aggelognc

New Member
Joined
Oct 14, 2018
Messages
2
hello!
I have a column of numbers in the form of 70.00.01.0024, 70.00.01.0013, 71.00.00.0013, 71.00.00.0024, etc. What im trying to do is, find the cells and cut the rows that they are at (e.g. B1:B4).

I tried doing that searching 70.**.**.**24 but doesn't work.

here's what I have so far



Sub Κουμπί1_Κλικ()


a = ActiveWorkbook.ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row


MsgBox (a)


For i = 1 To a


If Worksheets("CQ").Cells(i, 2).Value = "70.**.**.**24" Then


Worksheets("CQ").Rows(i).Cut
Worksheets("TQ").Activate
b = Worksheets("TQ").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("TQ").Cells(b + 1, 1).Select
ActiveSheet.Paste

End If


Next


Application.CutCopyMode = True
Worksheets("CQ").Select


End Sub


Any ideas ??
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
hello!
I have a column of numbers in the form of 70.00.01.0024, 70.00.01.0013, 71.00.00.0013, 71.00.00.0024, etc. What im trying to do is, find the cells and cut the rows that they are at (e.g. B1:B4).

I tried doing that searching 70.**.**.**24 but doesn't work.

here's what I have so far
Code:
Sub Κουμπί1_Κλικ()

a = ActiveWorkbook.ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row

MsgBox (a)

For i = 1 To a

  [B][COLOR="#FF0000"]If Worksheets("CQ").Cells(i, 2).Value = "70.**.**.**24" Then[/COLOR][/B]

{{{snip}}}
Any ideas ??
Try changing the red highlighted line of code to this...
Code:
If Worksheets("CQ").Cells(i, 2).Value Like "##.##.##.####" Then
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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