Write only first letter in row VBA

KlausW

Active Member
Joined
Sep 9, 2020
Messages
458
Office Version
  1. 2016
Platform
  1. Windows
Hi every one
I have a challenge
In an Excel sheet I use for work planning, you write T for service, S for sailed and F for free.
In row 35.
It also goes very well, but when I write T on a Tuesday or Thursday, it will say Tuesday or Thursday, and if I write S on a Sunday, it will say Sunday, and if I write F on a Friday, it will say Friday . Is there a VBA solution so that Excel only writes the first letter.
Any help will be appreciated
Best Regards
Klaus W
 

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"
Can you post what has been working for you? Not clear what you're trying to do exactly.
 
Upvote 0
Have you tried creating a validation list for the 3 options and also check your excel Preferences, Fomula and deselect Auto complete.

Also a good idea to post some example data.
 
Upvote 0
Hello again, I have posted a picture that shall explain what happens in row 35 when I type the letters as described in #1

In column 36, show what it should look like. However, it must appear in row 35.

Does it make sense?

Best regards

Klaus W
 

Attachments

  • Pic01.png
    Pic01.png
    11.1 KB · Views: 21
Upvote 0
What do you have in Row 9 and the other hidden rows between 11 and 35 ?
Many formulas that calculate what should happen based on the letters you type in row 35. Nothing that I have an effect on row 35. In Row 9 stand public holidays in Denmark
 
Upvote 0
Insert a blank row after row 9, you can hide it if you want.
Then see if the issue you are experiencing goes away.
 
Upvote 0
I'm not sure if I understood correctly, but try this macro in the worksheet code module.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    Application.EnableEvents = False
    If Intersect(Target, Range("C35:I35")) Is Nothing Then Exit Sub
    Target = Left(Target, 1)
    Application.EnableEvents = True
End Sub
 
Upvote 0
Solution
@mumps, I believe the underlying issue is that Excel is trying to help with data input using autocomplete using previously used words in the same column.
A fully blank row is the top border of this, and the previously used words may or may not include the first row depending on whether Excel recognises it as being a Heading row. (I do not have a definitive idea of how Excel determines whether it is or is not a heading row)

The auto complete uses the same logic as can be mimicked by using Alt+Down Arrow on the next data entry row of a column. It produces a drop down list in alphabetical order of the previously used entries in that column, which is the same list auto complete is using.

The theory is that if Klaus puts a blank row before the Monday Tuesday heading row, it will recognise Monday Tuesday... as the heading row and exclude it from the auto complete / previously used text list.
If that fails using your macro might be the logical next step.

I have used alt+down arrow in the 2 images below:

1714312819967.png

This may help (1.5 mins)

 

Attachments

  • 1714312775678.png
    1714312775678.png
    57.3 KB · Views: 12
Last edited:
Upvote 0

Forum statistics

Threads
1,224,847
Messages
6,181,325
Members
453,032
Latest member
Pauh

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