Code for Control + Shift + "

Boost

Board Regular
Joined
Jan 10, 2013
Messages
84
Hi Everyone,

Anyone have any idea how to code a shortcut:
Control Shift Apostrophe (Control+Shift+")?
I am trying to copy the last cell in a column to the cell below it at the end of a long macro. It is working and making all the sheets, but I need to add one line using the contents of the final line cells above when the totals are printed. The number of rows will vary every month so it needs to deal with the last line. The keyboard shortcut works great so it would be helpful to know how to code it.

Thanks
 
Last edited:

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
That is actually a quote, not an apostrophe, but the shift handles it. Is OEMQuotes what I am looking for?

Thanks
 
Upvote 0
The following code will copy the value from the cell above into the active cell (you can change ActiveCell to an actual cell reference if desired)...

ActiveCell = ActiveCell.Offset(ActiveCell.Row > 1).Value
 
Upvote 0
This script will do what you want.

It will enter into the active cell the value in the cell above the active cell.

To add this into your script it may be better to show us your script.

Code:
Sub Active_Cell_Value()
ActiveCell.Value = ActiveCell.Offset(-1).Value
End Sub
 
Upvote 0
This script will do what you want.

Code:
Sub Active_Cell_Value()
ActiveCell.Value = ActiveCell.Offset(-1).Value
End Sub
That code will error out if executed with the ActiveCell on Row 1... that is why I used a logical expression instead of hard-coding 1 in the code I posted in Message #3.
 
Upvote 0
Your correct. But I can hardly ever think that would happen. Enter into this cell the value that is in the cell above which does not exist. Thanks for pointing that out.
That code will error out if executed with the ActiveCell on Row 1... that is why I used a logical expression instead of hard-coding 1 in the code I posted in Message #3.
 
Upvote 0
Hi guys,

i am am not getting this to do anything. It runs, but nothing shows up in the cells. I have tried changing to a cell reference as well with no luck.

The code below for columns "F" and "I" is performed on all sheets after they are created and it works populating each sheet exactly the same. In Column "B" I need to also have the last row copy what is in that cell to the cell below it (this will be a different value on each sheet). The code I have below "runs", but does not populate the cell. (It should be on the same line as columns "F" and "I".) Can you help?


[lr = Range("F" & Rows.Count).End(xlUp).Row
we.Range("F" & lr).Offset(1, 0).Value = "01-Oper:0000 Balance Sheet"

lr = Range("I" & Rows.Count).End(xlUp).Row
ws.Range("I" & lr).Offset(1, 0).Value = "Monthly Credit Card Charges"

lr = Range("B" & Rows.Count).End(xlUp).Row
ActiveCell = ActiveCell.Offset(ActiveCell.Row > 1).Value]

I also tried the other suggestion with no luck. Any suggestions?

Thanks
 
Last edited:
Upvote 0
Hi guys,

i am am not getting this to do anything. It runs, but nothing shows up in the cells. I have tried changing to a cell reference as well with no luck.

The code below for columns "F" and "I" is performed on all sheets after they are created and it works populating each sheet exactly the same. In Column "B" I need to also have the last row copy what is in that cell to the cell below it (this will be a different value on each sheet). The code I have below "runs", but does not populate the cell. (It should be on the same line as columns "F" and "I".) Can you help?


[lr = Range("F" & Rows.Count).End(xlUp).Row
we.Range("F" & lr).Offset(1, 0).Value = "01-Oper:0000 Balance Sheet"

lr = Range("I" & Rows.Count).End(xlUp).Row
ws.Range("I" & lr).Offset(1, 0).Value = "Monthly Credit Card Charges"

lr = Range("B" & Rows.Count).End(xlUp).Row
ActiveCell = ActiveCell.Offset(ActiveCell.Row > 1).Value

I also tried the other suggestion with no luck. Any suggestions?

Thanks
Try replacing the red line of code with this...

Range("B" & lr + 1).Value = Range("B" & lr).Value
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,048
Members
448,543
Latest member
MartinLarkin

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