Discussion Locked

Excel: Force uppercase/Copy cell above?

0 helpful
12 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Two part Excel question:
1. How would you force uppercase for an entire column? (I'm having trouble with the syntax for the 'UPPER' function).
2. How would you define a macro/function-key which would duplicate whatever is in the cell above into the active cell?

12 replies

by mbazzell

1. Here is the formula for the Upper function: =UPPER(A1)
Assuming your data is in column A. The function is inserted in B1. Then I drag to copy the function down the entire column. Now my text that was in A1(lowercase) is also in B and is nowUpper case.

2. I would need some more info on this question before I could answer it.

by rickatwork

Clarification for both Excel questions:
1. I'd like to force uppercase in the same column where the data is being entered, not create a duplicate column. If you enter data in A1, how do you force A1 to be uppercase only?
2. If entering data in C7, how would you create a macro that would copy the data from the cell immediately above (in this case, C6) using a single keystroke (i.e. F1)?

by dklippert

#1 might be done with an On_Event code, but dExcel does not have the same capability as Access.
#2 is done the same way as Access Ctrl+'

by rickatwork

In resonse to Doug's answer:
1. Does anyone know how to direct Excel to translate lower to upper case as data is being entered into a cell (with the result ending up in the same cell)? As Doug mentioned, it's easy in Access...
2. 'CTRL+' did not have the desired affect. It invokes an Insert, not a copy from the cell above and requires additonal mouse clicks. In any case, it didn't work.

by rickatwork

How do you copy from the cell above in Excel?

Use: 'CTRL d' It works!

Hey, do I get points for answering my own question? 8^)

by rickatwork

My apologies to Doug. His answer for part 1 of the Excel question does work, I just misread it.

To copy from cell above, CTRL ' also works, although Excel help recommends using CTRL d

by dklippert

There is a subtle difference between Ctrl' and d. The Ctrl' leaves you in edit mode, while Ctrl d just copies. Interesting.

by dklippert

Sanjay Kulkarni has it. I just cobbled togeather the same code. The sheet level codes are interesting.

by sankulpune

1) In the change event of the Excel Worksheet (Sub Worksheet_Change(ByVal Target As Range)) put the following code (assuming you want all caps in column A ie 1)

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column = 1 Then
Target = UCase(Target)
End If

End Sub

This will convert everything you type column "A" to uppercase.

2) In the selection change event of the Excel Worksheet (Sub Worksheet_SelectionChange(ByVal Target As Range)) put the following code

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Target = Cells(Target.Row - 1, Target.Column)

End Sub

This will automatically copy the contents of the cell above to the current cell that you can subsequently override.

You may need to add error checking code which I have not done.

With regards,

Sanjay Kulkarni.

This discussion is closed to new replies.