Inserting ' in blank cells

bloomingflower

New Member
Joined
Mar 9, 2020
Messages
19
Office Version
  1. 2019
Platform
  1. Windows
Hi,
Do you know how to make a code that will enter ' in blank cells in column range A-C? Amount of rows differs in spreadsheets.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
How about
VBA Code:
Sub bloomingflower()
   On Error Resume Next
   Range("A:C").SpecialCells(xlBlanks).Value = "'"
   On Error GoTo 0
End Sub
 
Upvote 0
How about
VBA Code:
Sub bloomingflower()
   On Error Resume Next
   Range("A:C").SpecialCells(xlBlanks).Value = "'"
   On Error GoTo 0
End Sub
Hi,
Thank you for your help, but if I have blank cell in column A, then I have data in column B, and cell in column C is blank, then it is not entering ' in column C - only in A and then it goes to next row. Could you please tell me how to modify it so it will work in such case as well?
 
Upvote 0
Do you have any data in column C?
 
Upvote 0
Are you saying that sometimes there will only ever be data in columns A & B?
 
Upvote 0
I have all posibilities in rows:
Data only in A,
Data only in B
Data only in C
Data in A&B, C empty
Data in B&C, A empty
Data in A&C, B empty
Data in A,B&C
 
Upvote 0
Ok, how about
VBA Code:
Sub bloomingflower()
   Dim UsdRws As Long
   UsdRws = Range("A:C").Find("*", , xlValues, , xlByRows, xlPrevious, , , False).Row
   With Range("A1:C" & UsdRws)
      .Value = Evaluate("If(" & .Address & "="""",""'""," & .Address & ")")
   End With
End Sub
 
Upvote 0
Ok, how about
VBA Code:
Sub bloomingflower()
   Dim UsdRws As Long
   UsdRws = Range("A:C").Find("*", , xlValues, , xlByRows, xlPrevious, , , False).Row
   With Range("A1:C" & UsdRws)
      .Value = Evaluate("If(" & .Address & "="""",""'""," & .Address & ")")
   End With
End Sub
Thank you very much
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,617
Latest member
Narendra Babu D

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