Find last row and column and put dashes in empty cells starting at row 19

Andy15

Board Regular
Joined
Apr 1, 2017
Messages
56
Hi Guys,
I am looking for a bit of help with some data I need to work with. I have an excel sheet that contains varied amounts of data. some of the cells are blank and I am looking for some code to put a - (dash) in all of the empty cells starting at row 19

I need the code to find the last row and column of data and then but dashes in all the blank cells starting at row 19

Thank you for any help received
Andy
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Give this a try...
Code:
[table="width: 500"]
[tr]
	[td]Sub DashesInBlanksRow19Down()
  Range("19:" & Cells.Find("*", , xlValues, , xlRows, xlPrevious, , , False).Row).SpecialCells(xlBlanks).Value = "-"
End SUb[/td]
[/tr]
[/table]
 
Upvote 0
Hi Rick,

Thank you so much for your reply. The code puts dashes in as requested but for some reason it fills from row 19 as requested and finds the last row but it is not finding the last column, my data finished at row M but the dashes were added to column up to Cq

Any advice would be welcomed

Thanks
Andy
 
Upvote 0
but it is not finding the last column, my data finished at row M but the dashes were added to column up to Cq
Sorry, give this macro a try instead...
Code:
[table="width: 500"]
[tr]
	[td]Sub DashesInBlanksRow19Down()
  Range("A19:" & Cells(Cells.Find("*", , xlValues, , xlRows, xlPrevious, , , False).Row, Cells.Find("*", , xlValues, , xlByColumns, xlPrevious, , , False).Column).Address).SpecialCells(xlBlanks).Value = "-"
End Sub[/td]
[/tr]
[/table]
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

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