Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88054

Fill column B with column A

$
0
0

So, I have two columns. Column A has content with <> tags and Column B has content with [].

1    <hi>     [hi]
2    hello    bye
3    </hi>    [/hi]

Column B has a filter on top and both columns are filtered so that the cells with <> and [] are left out, and then I select all Column A and move it to B (with the little 'plus' sign at the bottom or top of the selection). The ending result would be something like this, when unfiltered:

1    <hi>     [hi]
2    hello    hello
3    </hi>    [/hi]

So I make a macro for this and it all works alright until it gets to Selection.FillRight

  Selection.AutoFilter
    ActiveSheet.Range("$B:$B").AutoFilter Field:=1, Criteria1:="<>*[*", _
        Operator:=xlAnd
    Range("A1:A25").Select
    Selection.FillRight
    ActiveSheet.Range("$B:$B").AutoFilter Field:=1
End Sub

I've tried using this

Selection.AutoFilter
    ActiveSheet.Range("B1:B"& Range("B"& Rows.Count).End(xlUp).Row)

or

Selection.AutoFilter
    ActiveSheet.Range("$B$1:$B$25")

instead but it won't work either. Any idea of how to fill all (filtered) content from Column A to Column B? Thank you!


Viewing all articles
Browse latest Browse all 88054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>