• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Automating cell Autofilling

Visor

Member
Forum Dear friends, greetings.
I would like to make the cells in the column B only as far as no corresponding information in column A. So far I Autofilling autorrellene specifying the rank, but ... there is another way to do more automated?
For example, first click on the red button and then on the blue button
Thank you in advance for your support
 

Attachments

  • RELLENAR.xlsm
    18.5 KB · Views: 4
This is how I would do it, takes just a single macro.
Code:
Sub TestFill()
Dim rngBlock As Range
Dim r As Range

'Grab all the blocks of data
Set r = Range("A2:A10000").SpecialCells(xlCellTypeConstants)

'Error check
If r Is Nothing Then
    MsgBox "Couldn't find info."
    Exit Sub
End If

Application.ScreenUpdating = False
'For each block of data, fill in items to the right
For Each rngBlock In r.Areas
    rngBlock.Offset(0, 1).FillDown
Next
Application.ScreenUpdating = True
End Sub
 
Awesome!!
Very thankful!!

But if the database was also shown in this file that I go, what would the code.
I ask because I don´t find in your code something that recognizes the ranks in yellow separating each block

Maybe es this:
Code:
For Each rngBlock In r.Areas
and each block is separated by empty row!!!??
 

Attachments

  • RELLENAR V2.xlsm
    18.3 KB · Views: 2
Are there blanks, or no blanks? I'm confused. Do you need to insert blanks? Which is your actual starting condition, and what is the final desired output?
 
I'm sorry, it is not my intention to cause confusion, I added this question because I have been forced to separate the rows of records in this database. So I wanted to know how would the code "if" you do not have blank rows, ie it is continuous. So when you have those cases I sabria code apply.
and then I got the file on this case
Thanks for your support
 
This would do that.
Code:
Sub SimpleCode()
'fill blanks
Range("B2:B10000").SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
End Sub
 
Back
Top