ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I change columns inside a range? (https://www.excelbanter.com/excel-programming/399449-how-do-i-change-columns-inside-range.html)

LongBeachGuy

How do I change columns inside a range?
 
I need Range("B:B") to change to Range("D:D"), Range("F:F"), and so.
I need the "Next_line" to be 2 when the next column is selected.


Next_Line = Application.CountA(Range("b:b"), NumColumns)

I want to do:
Next_Col = 0

' Then when the next column comes:

Next_Col = Next_Col + 2
Next_Line = Application.CountA(Range("Next_Col:Next_Col"),
NumColumns)

How do I do this?

Jose


Leith Ross[_2_]

How do I change columns inside a range?
 
On Oct 16, 7:41 pm, LongBeachGuy wrote:
I need Range("B:B") to change to Range("D:D"), Range("F:F"), and so.
I need the "Next_line" to be 2 when the next column is selected.

Next_Line = Application.CountA(Range("b:b"), NumColumns)

I want to do:
Next_Col = 0

' Then when the next column comes:

Next_Col = Next_Col + 2
Next_Line = Application.CountA(Range("Next_Col:Next_Col"),
NumColumns)

How do I do this?

Jose


Hello Jose,

Like this...

Next_Col = Next_Col + 2
Next_Line = Application.CountA(Cells(1, Next_Col).EntireColumn,
NumColumns)

Sincerely,
Leith Ross



All times are GMT +1. The time now is 02:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com