VBA code to input function adjacent to each non-blank cell

markgoolsbay

New Member
Joined
Aug 24, 2017
Messages
4
Hello,

I'm new to VBA and can't find a workable solution to my issue.

I'm trying to insert my custom function adjacent (0,1) to each non-black cell on a worksheet. So if I have a string in cell D3, it will insert MyFunction() into cell E3. And loop through to do this for every non-blank cell in this worksheet.

Any help would be great!!

Mark
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Beside each blank cell in the whole worksheet? Here's an example of inserting a formula in the blank cells for the used range. HTH. Dave
Code:
Dim r As Range
For Each r In Sheets("sheet1").UsedRange
If r.Value = vbnullsting Then
r.Offset(rowOffset:=0, columnOffset:=1) = "=(A2)"
End If
Next r
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,172
Members
449,071
Latest member
cdnMech

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