Copy content to a selected row

vabtroni

New Member
Joined
Aug 1, 2017
Messages
43
Office Version
  1. 365
Platform
  1. Windows
Hi! đź‘‹đź‘‹

First of all, a happy 2023 to everyone!

I wonder if some of you could cast some light on a problem I have:

The workspace is D9:W98 in a PROTECTED worksheet.

On rows 10, 13, 16, 19, 22 (...) 94, and 97 -each 3 rows- I have a sequence of VLOOKUP formulas on D:W wich require horizontal continuity (meaning, the sequence on each row is
independent from other rows), that the user can override by absolute values. However, there is a chance that the user may need to reset to the original formulas on a given
row.

The original formulas are stored on D101:X101 and hidden from the user's view (black font and black background), and PROTECTED (user can't select these cells).

I need a macro that works this way:

1) Unprotect worksheet
2) Identify the row currently selected;
3) If the row selected is NOT one of those rows (10,13,16,19, etc, 94 and 97), the macro will stop with a message "Wrong row selected";
4) Copy the content of D101:X101 and paste it -FORMULAS ONLY- to the D cell of the selected row;
5) Protect worksheet

The PASTE must be -FORMULAS ONLY- , as the workspace is heavily implemented with conditional formatting (wich is essencial for the workspace to be fully functional), and also
because I do not want to paste the black background of the original formulas to the destination row.

Best regards everyone!
V.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,223,912
Messages
6,175,341
Members
452,638
Latest member
Oluwabukunmi

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