Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6949195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:55:21+00:00 2026-05-27T13:55:21+00:00

This follows on from a previous question here where I asked how to develop

  • 0

This follows on from a previous question here where I asked how to develop an input box that required a data to be entered in a specific format by the user (eg: Q4 2010)

I now need to take the first 2 character of the user input (always to be Q1, Q2, Q3 or Q4) and change the text in another cell depending on the outcome. Specifically, if the user enters a string starting with Q1 or Q3, I need it to copy <insert text1> into a cell in Sheet3, and if they enter Q2 or Q4 it copies <insert text2> in the same cell instead.

I have no idea how to consider only part of an input, so any help most welcome 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:55:21+00:00Added an answer on May 27, 2026 at 1:55 pm

    You could try this to populate A1 of a sheet called Sheet3 with the two strings

    [Updated as per msgbox asking for user input in specific format to be bullet proof using Regular Expressions]

    Option Explicit
    Sub Rattle_and_hmmmm2()
        Dim strReply As String
        Dim strTitle As String
        Dim objRegex As Object
        Dim objRegMC As Object
        Set objRegex = CreateObject("vbscript.regexp")
        With objRegex
            .ignorecase = True
            .Pattern = "^Q([1-4])\s20[10-20]{2}$"
            Do
                If strReply <> vbNullString Then strTitle = "Please retry"
                strReply = Application.InputBox("Enter period (format: Q4 2010) to update, or hit enter to escape", strTitle, "Q" & Int((Month(Now()) - 1) / 3) + 1 & " " & Year(Now()), , , , , 2)
                If strReply = "False" Then
                    MsgBox "User hit cancel, exiting code", vbCritical
                    Exit Sub
                End If
            Loop Until .test(strReply)
        Set objRegMC = .Execute(strReply)
        End With
        Select Case objRegMC(0).submatches(0)
        Case 2, 4
        Sheets("Sheet3").[a1] = "insert text2"
        Case 1, 3
        Sheets("Sheet3").[a1] = "insert text1"
        End Select
        Sheets("Sheet1").[b14].Value = UCase$(strReply)
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question follows on from a previous question, that has raised a further issue.
This question follows on from a previous question which can be found here: Need
This problem follows on from a previous question . When I run the following
OK, this kind of follows on from my previous question . What I would
All, this is a follow up from a previous question here: C# formatting external
From my previous question for selecting specific html text, I have gone through this
Note that this is a follow-up question from my previous one: How to memorize
This is a continuation question from a previous question I have asked I now
This follows on from my previous question about Moose structured types. I apologise for
This question follows my previous question here in case anyone is interested. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.