I have supposedly empty cell, where I have used Replace function to replace some of data. When i try to check if it's empty, its returning false. How do i check hidden values in cell?
Thanks for the reply. Before I did the replace, inside the cells are all string data. Here is what found after i press F2 key to the replaced cell. It blinks in 3rd space from the left not from the left most of the cell. This should have tell me something but I do not know. Do you know how to make it to the left most?
Yeah it contains some space. Well actually i wrote replace macro in which it commpares the content of the cells in three sheets. after i run the macro, the replaced cell have spaces. Any idea?
its macro that i wrote. well, do you know how to make the replaced cell start from the leftmost of the cell? i try to use left indent but it does not work.
Sub Macro1()
Dim row As Integer
Dim shtrow As Integer
row = 2
Dim working_dog_str As String
Dim working_paul_str As String
Dim working_morlet_str As String
Dim working_haub_str As String
Dim working_daub_str As String
Dim working_dog_str2 As String
Dim working_paul_str2 As String
Dim working_morlet_str2 As String
Dim working_haub_str2 As String
Dim working_daub_str2 As String
Dim temp As String
Do While Sheets(1).Range("A1").Cells(row, 1).Value <> ""
row1_variable = Sheets(1).Range("A1").Cells(row, 1).Value
If (row1_variable = Sheets(sht).Cells(shtrow, 1).Value) Then
'------------------------------------------DOG-----------------------------------------
' If InStr(working_dog_str, working_dog_str2) <> 0 Then
If InStr(1, working_dog_str, "(D,+,H)") And InStr(working_dog_str2, "(D,+,H)") Then
Sheets(1).Cells(row, 2).Replace What:="(D,+,H),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(1, working_dog_str, "(D,-,H)") And InStr(working_dog_str2, "(D,-,H)") Then
Sheets(1).Cells(row, 2).Replace What:="(D,-,H),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(1, working_dog_str, "(D,+,M)") And InStr(working_dog_str2, "(D,+,M)") Then
Sheets(1).Cells(row, 2).Replace What:="(D,+,M),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(1, working_dog_str, "(D,-,M)") And InStr(working_dog_str2, "(D,-,M)") Then
Sheets(1).Cells(row, 2).Replace What:="(D,-,M),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(1, working_dog_str, "(D,+,L)") And InStr(working_dog_str2, "(D,+,L)") Then
Sheets(1).Cells(row, 2).Replace What:="(D,+,L),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(1, working_dog_str, "(D,-,L)") And InStr(working_dog_str2, "(D,-,L)") Then
Sheets(1).Cells(row, 2).Replace What:="(D,-,L),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
'End If
'-------------------------------Paul------------------------------------------------------
' If InStr(working_paul_str, working_paul_str2) <> 0 Then
If InStr(working_paul_str, "(P,+,H)") And InStr(working_paul_str2, "(P,+,H)") Then
Sheets(1).Cells(row, 3).Replace What:="(P,+,H),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_paul_str, "(P,-,H)") And InStr(working_paul_str2, "(P,-,H)") Then
Sheets(1).Cells(row, 3).Replace What:="(P,-,H),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_paul_str, "(P,+,H)") And InStr(working_paul_str2, "(P,+,H)") Then
Sheets(1).Cells(row, 3).Replace What:="(P,+,H),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_paul_str, "(P,+,M)") And InStr(working_paul_str2, "(P,+,M)") Then
Sheets(1).Cells(row, 3).Replace What:="(P,+,M),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_paul_str, "(P,-,M)") And InStr(working_paul_str2, "(P,-,M)") Then
Sheets(1).Cells(row, 3).Replace What:="(P,-,M),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_paul_str, "(P,+,L)") And InStr(working_paul_str2, "(P,+,L)") Then
Sheets(1).Cells(row, 3).Replace What:="(P,+,L),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_paul_str, "(P,-,L)") And InStr(working_paul_str2, "(P,-,L)") Then
Sheets(1).Cells(row, 3).Replace What:="(P,-,L),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
' End If
'-----------------------------------------Morlet--------------------------------------------
' If InStr(working_morlet_str, working_morlet_str2) <> 0 Then
If InStr(working_morlet_str, "(M,+,H)") And InStr(working_morlet_str2, "(M,+,H)") Then
Sheets(1).Cells(row, 4).Replace What:="(M,+,H),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_morlet_str, "(M,-,H)") And InStr(working_morlet_str2, "(M,-,H)") Then
Sheets(1).Cells(row, 4).Replace What:="(M,-,H),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_morlet_str, "(M,+,M)") And InStr(working_morlet_str2, "(M,+,M)") Then
Sheets(1).Cells(row, 4).Replace What:="(M,+,M),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_morlet_str, "(M,-,M)") And InStr(working_morlet_str2, "(M,-,M)") Then
Sheets(1).Cells(row, 4).Replace What:="(M,-,M),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_morlet_str, "(M,+,L)") And InStr(working_morlet_str2, "(M,+,L)") Then
Sheets(1).Cells(row, 4).Replace What:="(M,+,L),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_morlet_str, "(M,-,L)") And InStr(working_morlet_str2, "(M,-,L)") Then
Sheets(1).Cells(row, 4).Replace What:="(M,-,L),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
' End If
'-----------------------------------Haub--------------------------------------------------
' If InStr(working_haub_str, working_haub_str2) <> 0 Then
If InStr(working_haub_str, "(H,+,H)") And InStr(working_haub_str2, "(H,+,H)") Then
Sheets(1).Cells(row, 5).Replace What:="(H,+,H),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_haub_str, "(H,-,H)") And InStr(working_haub_str2, "(H,-,H)") Then
Sheets(1).Cells(row, 5).Replace What:="(H,-,H),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_haub_str, "(H,-,L)") And InStr(working_haub_str2, "(H,-,L)") Then
Sheets(1).Cells(row, 5).Replace What:="(H,-,L),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_haub_str, "(H,+,M)") And InStr(working_haub_str2, "(H,+,M)") Then
Sheets(1).Cells(row, 5).Replace What:="(H,+,M),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_haub_str, "(H,-,M)") And InStr(working_haub_str2, "(H,-,M)") Then
Sheets(1).Cells(row, 5).Replace What:="(H,-,M),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_haub_str, "(H,+,L)") And InStr(working_haub_str2, "(H,+,L)") Then
Sheets(1).Cells(row, 5).Replace What:="(H,+,L),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
' End If
'--------------------------------Daub-----------------------------------------------------
' If InStr(working_daub_str, working_daub_str2) <> 0 Then
If InStr(working_daub_str, "(Daub,+,H)") And InStr(working_daub_str2, "(Daub,+,H)") Then
Sheets(1).Cells(row, 6).Replace What:="(Daub,+,H),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_daub_str, "(Daub,-,H)") And InStr(working_daub_str2, "(Daub,-,H)") Then
Sheets(1).Cells(row, 6).Replace What:="(Daub,-,H),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_daub_str, "(Daub,+,M)") And InStr(working_daub_str2, "(Daub,+,M)") Then
Sheets(1).Cells(row, 6).Replace What:="(Daub,+,M),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_daub_str, "(Daub,-,M)") And InStr(working_daub_str2, "(Daub,-,M)") Then
Sheets(1).Cells(row, 6).Replace What:="(Daub,-,M),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_daub_str, "(Daub,+,L)") And InStr(working_daub_str2, "(Daub,+,L)") Then
Sheets(1).Cells(row, 6).Replace What:="(Daub,+,L),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If InStr(working_daub_str, "(Daub,-,L)") And InStr(working_daub_str2, "(Daub,-,L)") Then
Sheets(1).Cells(row, 6).Replace What:="(Daub,-,L),", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
'End If
End If
shtrow = shtrow + 1
Loop
Next sht
row = row + 1
Loop
End Sub
I will try to use trim function to remove the space.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.