Check cell content

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
Hi All,
Good Morning Guys. :)

This query I hope will use to every one in the future.
And i always have stuck with this similar query.

My query is - i want a code which checks first cell content and the content which i dont require only that part will omit and the rest of the content will display in next cell or o/p cell any.

Yesterday i put a query which is near by this.
I got one expert advise :pray: also but this query is not about the same as yesterday.

=MID(A1,1,FIND(".",A1)-1)&MID(A1,FIND(" ",A1),FIND(".",A1,FIND(" ",A1))-FIND(" ",A1))

Like this can we have a common code for this.
So i can use that code everytime, and atleast from my end i will make change as per the requirement.

But atleast to check the cell content and remove, is the main thing required for my every reports.

Therefore, a great helping hand require for this query. :help:
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
My query is - i want a code which checks first cell content and the content which i dont require only that part will omit

The meaning of this isn't clear. But perhaps:
=SUBSTITUTE(A1,"Hello ","")

This will return the contents of A1 with "Hello " removed.
 
Upvote 0
Its amazing.

Its really helpful if you provide me this by coding.

also the same related query is there.
 
Upvote 0
The reason bcoz asking for code coz for 1000 of records.
the criteria which i want to remove that like following-

abc sw11 pqr
pqr sw34 fgh
fgh sw012 gh
kj sw01111 gh

this "sw " and number along with sw wanted to remove.

that is not possible to use formula ech n every cell.

that y code require.

if u observe above,

"kj_sw01111_gh" - if you see, "_" mark is the space surely coming in my all reports.

if we judge that , cell (i,j) content contain sw and numbers till next space is coming.

Actually we have find space.
find first space. after first space read the content sw and its number till the next space coming.
and we can clear that.


This logic i required.
 
Last edited:
Upvote 0
Hi,

Can I get a VBA code to replace:

if a cell range is greater than or equal to 06:00 hours then it should replace by "P". If a cell range is less than 06:00 hours and greater than 01:00 hours it should replace by "HD".

Thanks in advance for your assistance.
 
Upvote 0
Hi,

Can I get a VBA code to replace:

if a cell range is greater than or equal to 06:00 hours then it should replace by "P". If a cell range is less than 06:00 hours and greater than 01:00 hours it should replace by "HD".

Thanks in advance for your assistance.

:eeek:

What happened?
Dear if u have any query u have to go to "New Thread Option".
From that u can put your query, any Expert will definatly assist for the same.

If u dont know the link,
Go to Message Board - Excel Question - New Thread
 
Upvote 0
I used Column A, change as necessary:

Code:
Sub test()
Dim c As Range
For Each c In Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
    c = RemoveText(c.Text)
Next
End Sub

Function RemoveText(r As String) As String
With CreateObject("vbscript.regexp")
    .Pattern = " .*? "
    RemoveText = Trim(.Replace(r, ""))
End With
End Function
 
Upvote 0

Forum statistics

Threads
1,224,520
Messages
6,179,267
Members
452,902
Latest member
Knuddeluff

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