A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
See https://www.dropbox.com/s/ergdnfj8sh48j0w/MASTER%20ALL%20Jul%2021%202.xlsm?dl=1
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
Not that great in VBA but still managed to write a code that:
Sub markAsPaid()
'this macro will print 1 in the Left cell beside the selected cell
If ActiveCell.Value <> "" Then
ActiveCell.Offset(0, -1).Value = 1
End If
End Sub
The macro works great but the problem is it becomes too time consuming to keep doing it one cell at a time.
Is there any way where I could print 1 in entire selected range in one shot rather than one at a time ??
Any help is appreciated.
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Re: "instead of marking cells to the left"
I was reading...
"where I could print 1 in entire selected range in one shot".
NLtL
Hey,
thanks for the help. But this code marks the selected range as 1 instead of marking the cells to its left.
Try this:
Sub markAsPaid()
With Selection.Offset(0, -1)
.FormulaR1C1 = "=IF(RC[1]="""","""",1)"
.Value = .Value
End With
End Sub
re: fill a range with a value
'---
Sub MarkAsPaidR1()
Dim rng As Excel.Range
Set rng = Excel.Selection
rng.Value = 1
End Sub
'---
NLtL
https://1drv.ms/u/s!Au8Lyt79SOuhZw2MCH7_7MuLj04?e=sAwbHU (free excel programs)