ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro-Return Blank Cell (https://www.excelbanter.com/excel-discussion-misc-queries/251051-macro-return-blank-cell.html)

Sudipta Sen[_2_]

Macro-Return Blank Cell
 
I am creating an Invoice by the help of macro where I want to clear all the
data from unlock cell after entering the buttom named NEXT or OK.So I could
enter fresh data in the same unlock cell.

How it possible?

Rdgs...Sudipta

Gary''s Student

Macro-Return Blank Cell
 
Sub setup()
Dim cel As Range, r As Range
For Each r In ActiveSheet.UsedRange
If r.Locked Then
Else
If cel Is Nothing Then
Set cel = r
Else
Set cel = Union(cel, r)
End If
End If
Next

If cel Is Nothing Then
Else
cel.Clear
End If

End Sub

--
Gary''s Student - gsnu200909

Sudipta Sen[_2_]

Macro-Return Blank Cell
 
Thank Gary for ur co-operation. But actually I want clear content without
disburbing my formula & format from individual cell. means from a2 , c2, a7,
d8 etc.

want to use
clear contents macro for mentioned cell.

With Loves
Sudipta

"Gary''s Student" wrote:

Sub setup()
Dim cel As Range, r As Range
For Each r In ActiveSheet.UsedRange
If r.Locked Then
Else
If cel Is Nothing Then
Set cel = r
Else
Set cel = Union(cel, r)
End If
End If
Next

If cel Is Nothing Then
Else
cel.Clear
End If

End Sub

--
Gary''s Student - gsnu200909



All times are GMT +1. The time now is 12:08 AM.

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