ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Fill cells automatically when cleared (https://www.excelbanter.com/excel-worksheet-functions/453180-fill-cells-automatically-when-cleared.html)

R0nald

Fill cells automatically when cleared
 
Hello all,

Is there any way cells get automatically populated with certain value when cleared or made empty?

Example,

Value to put on empty cells: 1234

A1 = 11
A2 = empty
A3 = 22

If the automated fill works the cells should have:

A1 = 11
A2 = 1234
A3 = 22

If I empty A1 then 1234 should be put automatically in it.
If I fill A2 with 33 then A2 should contain 33 until I clear it, then it should have 1234 again.

Appreciate any help on this question.

Ronald.

Claus Busch

Fill cells automatically when cleared
 
Hi,

Am Wed, 8 Mar 2017 04:26:04 -0800 (PST) schrieb R0nald:

Value to put on empty cells: 1234

A1 = 11
A2 = empty
A3 = 22

If the automated fill works the cells should have:

A1 = 11
A2 = 1234
A3 = 22


try:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub

If Len(Target) = 0 Then Target = 1234
End Sub


Regards
Claus B.
--
Windows10
Office 2016

R0nald

Fill cells automatically when cleared
 
Thanks Claus!
Despite of all it doesn't do anything :-(

What I did: Just copy paste it on a new module I've created on a new workbook.....

Do I miss something or did you assume I handle it differently?

Best regards.

Ronald.

Claus Busch

Fill cells automatically when cleared
 
Hi,

Am Wed, 8 Mar 2017 07:33:53 -0800 (PST) schrieb R0nald:

Despite of all it doesn't do anything :-(

What I did: Just copy paste it on a new module I've created on a new workbook.....

Do I miss something or did you assume I handle it differently?


this is a worksheet event macro. Right click on the sheet tab of the
expected sheet = Show Code and paste the code into the code window.


Regards
Claus B.
--
Windows10
Office 2016

Hồ Trịnh

Tại sao nên in quảng cáo tại công ty in ấn Kim Minh Th*nh

+ Bạt in hiflex được lấy từ đầu nguồn, đảm bảo giá nguyên v*t liệu in ấn tốt nhất

+ Hệ thống máy in hiflex mực dầu, máy in khổ lớn trực tiếp thực hiện in, khổ in chiều rộng l* 3.2m, chiều d*i in ấn không hạn chế, in mọi k*ch thước phông nền như bạn mong muốn

+ Quy trình l*m việc chuyên nghiệp, rút ngắn nhiều công đoạn rườm r*, mang đến cho quý khách những điều kiện tốt nhất.

+ T*p thể thiết kế thiết kế v* in ấn gi*u kinh nghiệm.
Nguồn : in băng rôn

R0nald

Fill cells automatically when cleared
 
Thanks Claus.
All well now.



All times are GMT +1. The time now is 06:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com