メインコンテンツへスキップ

Excelでセルを読み取り専用にする方法は?

多くの場合、ワークシート内の指定されたセルを他の人が編集できないようにする必要があります。 この記事では、指定したセルを読み取り専用にするためのXNUMXつの方法を紹介します。これにより、他のユーザーは読み取り以外にこれらのセルを編集できなくなります。

ワークシートを保護してセルを読み取り専用にする
ワークシートを保護せずにセルをVBAコードで読み取り専用にする


ワークシートを保護してセルを読み取り専用にする

読み取り専用にしたいセルのみをロックし、このワークシートを保護してそれを実現できます。 次のようにしてください。

1。 クリック 現在のワークシートの左上隅にあるボタンをクリックして、セル全体を選択します。

2。 プレス Ctrlキー + 1 キーを同時に開いて セルの書式設定 ダイアログボックス。 ダイアログボックスで、チェックを外します ロック 下のボックス 保護 タブをクリックして、 OK ボタン。 スクリーンショットを参照してください:

3.次に、読み取り専用にするセルを選択します(ここでは、範囲A1:C18のセルを選択します)。 を押します Ctrlキー + 1 キーを同時に開いて セルの書式設定 ダイアログボックスで ロック 下のボックス 保護 タブをクリックします OK

4.クリックしてください レビュー > 保護シート。 スクリーンショットを参照してください:

5.以下のスクリーンショットに示すように、ワークシートを保護するためにパスワードを指定して確認します。

これで、ロックされた範囲のセルは読み取り専用になりました。 範囲内のこれらの特定のセルを編集しようとすると、以下のスクリーンショットに示すようなプロンプトボックスが表示されます。


現在のワークブックで同時に複数/すべてのワークシートをパスワードで保護します。

Microsoft Excelでは、一度にXNUMXつのワークシートをパスワードで保護できます。 ここでは、 ワークシートを保護する & ワークシートの保護を解除する のユーティリティ Kutools for Excel 複数のワークシートまたは現在のワークブック内のすべてのワークシートをパスワードで同時に保護または保護解除します。
ダウンロードして今すぐ試してみてください! (30 日間の無料トレイル)


ワークシートを保護せずにセルをVBAコードで読み取り専用にする

ワークシートを保護してセルを読み取り専用にする必要がない場合。 このセクションのVBAスクリプトは、この問題を簡単に解決するのに役立ちます。

1.セルを読み取り専用にするために必要なシートタブを右クリックし、[ コードを表示 右クリックメニューから。

2.オープニングで アプリケーション向け Microsoft Visual Basic ウィンドウで、以下のVBAコードをコピーしてコードウィンドウに貼り付けます。

VBAコード:セルをExcelで読み取り専用にする

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Column = 1 Then
        If Target.Row = 3 Or Target.Row = 4 Or Target.Row = 5 Then
            Beep
            Cells(Target.Row, Target.Column).Offset(0, 1).Select
            MsgBox Cells(Target.Row, Target.Column).Address & " cannot be selected and edited as it is a read-only cell", _
            vbInformation, "Kutools for Excel"
        End If
    End If
End Sub

Note:このコードは、3つの列の指定されたセルを読み取り専用にすることができます。 このコードでは、セルA4、A5、およびAXNUMXが現在のワークシートで読み取り専用になります。

3。 プレス 他の + Q を閉じるためのキー アプリケーション向け Microsoft Visual Basic 窓。

現在のワークシートのセルA3、A4、またはA5をクリックすると、 Kutools for Excel 以下のスクリーンショットのようなダイアログボックスが表示され、カーソルが右隣のセルに自動的に移動します。

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Comments (12)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Very useful!!
This comment was minimized by the moderator on the site
Hi! How about if i want to just make 1 column editable and the rest uneditable? Thanks!
This comment was minimized by the moderator on the site
Hi Jac,
Please click on the column header to select the whole column, then do the steps mentioned in the post to unlock the column cells then protect the worksheet.
This comment was minimized by the moderator on the site
every usefull, thank you with gratitude
This comment was minimized by the moderator on the site
Thanks for the quick guidance.
This comment was minimized by the moderator on the site
Hi



I have mulipe sheets Menu ( option A1& A2) , A1 and A2 and VIEW work sheets ( where i will have BROWSE button) .



1. In menu i will select A1..

2. it will go to VIEW sheet ( which is working fine) till now ..

3. when i click on the BROWSE in the VIEW sheet A1 shee shoulf get displayed and the content present in the cells should be non editable..



Could you please help..
This comment was minimized by the moderator on the site
Good day,
Supposing there is a Command Button (ActiveX Control) in the View sheet. After inserting the below VBA into the worksheet code window, click on the button, in a popping up Kutools for Excel dialog box, specify a password to protect the sheet A1. Then sheet A1 is opened and non editable.

Private Sub CommandButton1_Click()
Dim xSheet As Worksheet
Dim xStr As String
On Error Resume Next
Set xSheet = Sheets("A1")
If xSheet Is Nothing Then Exit Sub
xSheet.UsedRange.Locked = True
xStr = Application.InputBox("Please specify a password to protect the sheet A1", "KuTools for Excel", , , , , , 2)
If xStr = False Or xStr = "" Then Exit Sub
xSheet.Protect xStr
xSheet.Activate
End Sub
This comment was minimized by the moderator on the site
i just want to make few cells of a book locked for input, only they shows the result as i programmed them to do so
This comment was minimized by the moderator on the site
Hey, Thanks a lot for this steps.


However, what if I want to copy the values in the cells that I have locked?
This comment was minimized by the moderator on the site
Dear Yahia,
The locked cells in a protected worksheet can't be copied.
This comment was minimized by the moderator on the site
Very Helpful. Thanks ! :D
This comment was minimized by the moderator on the site
Dear i want to protect the hidden cells from by copying to the new sheet, is there any option in the excel sheet for that. Means no can able to view the formulaes after copying from one sheet to other sheet.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations