Frowan1908
New Member
- Joined
- Oct 25, 2024
- Messages
- 2
- Office Version
- 2016
- Platform
- Windows
Hi all,
Hopefully an easy question for you .
I am very new to VBA and I am currently fiddling in an already made document to try and understand what is happening.
It is an Excel sheet where we want to copy data from various sheets into a single sheet.
It starts with searching the input value (manually done in the single sheet) in the various sheets which is the common value (from there the search initiates in that row) and declaring that as ' C'.
One of the commands is to look for non empty cells starting from column G (specified by finding the common value stated above and just adding columns (Cells(c.Row, c.Column + 6).Select)) and declaring that as 'D' (Set d = ActiveCell).
It will then search all the way through to the end with the following:
Cells(d.Row, d.Column).Select
Selection.End(xlToRight).Select
Set d = ActiveCell
I would like the selection to stop at column JK but can't seem to find an 'easy' way to do that.
Should I specify the range (active row - column G - JK) earlier and then refer to that range every time? Or is there a simple addon to the ' Selection.End(xlToRight).Select' line?
Hope that what I wrote made sense, I would gladly clarify things if necessary.
Thanks in advance for looking into this.
KR,
Rowan
Hopefully an easy question for you .
I am very new to VBA and I am currently fiddling in an already made document to try and understand what is happening.
It is an Excel sheet where we want to copy data from various sheets into a single sheet.
It starts with searching the input value (manually done in the single sheet) in the various sheets which is the common value (from there the search initiates in that row) and declaring that as ' C'.
One of the commands is to look for non empty cells starting from column G (specified by finding the common value stated above and just adding columns (Cells(c.Row, c.Column + 6).Select)) and declaring that as 'D' (Set d = ActiveCell).
It will then search all the way through to the end with the following:
Cells(d.Row, d.Column).Select
Selection.End(xlToRight).Select
Set d = ActiveCell
I would like the selection to stop at column JK but can't seem to find an 'easy' way to do that.
Should I specify the range (active row - column G - JK) earlier and then refer to that range every time? Or is there a simple addon to the ' Selection.End(xlToRight).Select' line?
Hope that what I wrote made sense, I would gladly clarify things if necessary.
Thanks in advance for looking into this.
KR,
Rowan