What are the equivalent keywords to perform string manipulations?

joe7894

New Member
Joined
Mar 6, 2013
Messages
18
Hi all,

I want to convert a sentence (stored as a string variable) from the present tense to the past tense but I'm having trouble locating the relevant string manipulation commands to accomplish the task.

Does anybody have any idea how I could do this within my current code (shown below)?

Code:
Sub TestMacro()'
' TestMacro Macro
'
' Create string variable
    Dim undoText As String
' Assign the text to string variable
    undoText = Mid$(Application.CommandBars(1).Controls("Edit").Controls(1).Caption, 6)
' See if Excel has just been launched
    If StrComp(" &Undo", undoText, False) = 0 Then
        MsgBox ("Welcome.")
    Else
' Change text to be in past tense
        ' PUT CODE HERE!
' Add the text to the string to be displayed in a message box
        MsgBox ("You just" & undoText & ".")
    End If
End Sub


' Repeatedly check for user interaction whenever a change is detected
Private Sub Worksheet_Change(ByVal Target As Range)
    Call TestMacro
End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
With all the variations and special rules in the English language, I think this is going to be dang-near impossible unless you are willing to create a lookup list of all the possible verbs that might ever be found and what the past tense of those verbs are (or stumble upon some really cool plug-in that might do this sort of thing).
 
Last edited:
Upvote 0
Consider:

Code:
Sub StringFixer()
Dim s1 As String
s1 = "I am happy"
s2 = "was"
s3 = "will be"
s4 = "am"


MsgBox Replace(s1, s4, s2)
MsgBox Replace(s1, s4, s3)
End Sub
 
Upvote 0
With all the variations and special rules in the English language, I think this is going to be dang-near impossible unless you are willing to create a lookup list of all the possible verbs that might ever be found and what the past tense of those verbs are (or stumble upon some really cool plug-in that might do this sort of thing).
I know it seems pointless, but this is for research purposes so after I've done a test run of the function for my participants to do I should know every word they're likely to run into. So far, the only one is "Typing"!
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

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