PritishS
Board Regular
- Joined
- Dec 29, 2015
- Messages
- 119
- Office Version
- 2007
- Platform
- Windows
Dear Sirs,
Wish you all a Happy New Year!
After doing 2 days of searching I'm here for you kind help!
Requirement:
I want to copy a row range of data to other worksheet. For example- Range(A1:H1) from sheet1 to sheet2. Im am using this code below to do this
Problem Facing:
My problem is in this range A:H, D and F columns are hidden.
Sheet1:
<tbody>
</tbody>
With above mentioned code after pasting the same range in sheet2 is giving me result as shown below
Sheet2:
<tbody>
</tbody>
But requirement is
Sheet2:
<tbody>
</tbody>
Note:
Please note I can not unhide those cells, copy and paste then hide those cell. Because in actual case I have lots of column from A to CA and many are hidden columns and those are not fixed. So vba to unhide columns, copy paste and then hide is not applicable in this case.
Questions:
Is there any direct vba code like (xlcelltypevisible) which can be used to get the full range with hidden cells?
Thank you Very much in advance!!
Thanks & Regrads,
PritishS
Wish you all a Happy New Year!
After doing 2 days of searching I'm here for you kind help!
Requirement:
I want to copy a row range of data to other worksheet. For example- Range(A1:H1) from sheet1 to sheet2. Im am using this code below to do this
Code:
Sub CopyData()
Dim nextrow As Long, rngRow As Range, rfound As Range, sFind As String, Worksheet As Worksheet
nextrow = Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row + 1
Set rngRow = Range("A" & ActiveCell.Row & ":H" & ActiveCell.Row)
rngRow.Copy Destination:=Sheets("Sheet2").Range("A" & nextrow)
sFind = Range("A" & ActiveCell.Row).Value
With Sheets("Sheet2")
Set rfound = .Columns(1).Find(What:=sFind, After:=.Cells(1, 1))
End With
Set rngRow = Nothing
End Sub
Problem Facing:
My problem is in this range A:H, D and F columns are hidden.
Sheet1:
A1 | B1 | C1 | D1 | E1 | F1 | G1 | H1 |
Pen | Pencil | Inkpot | Ball | Bat | Hat |
<tbody>
</tbody>
With above mentioned code after pasting the same range in sheet2 is giving me result as shown below
Sheet2:
A1 | B1 | C1 | D1 | E1 | F1 | G1 | H1 |
Pen | Pencil | Inkpot | Ball | Bat | Hat |
<tbody>
</tbody>
But requirement is
Sheet2:
A1 | B1 | C1 | D1 | E1 | F1 | G1 | H1 |
Pen | Pencil | Inkpot | Bal | Bat | Hat |
<tbody>
</tbody>
Note:
Please note I can not unhide those cells, copy and paste then hide those cell. Because in actual case I have lots of column from A to CA and many are hidden columns and those are not fixed. So vba to unhide columns, copy paste and then hide is not applicable in this case.
Questions:
Is there any direct vba code like (xlcelltypevisible) which can be used to get the full range with hidden cells?
Thank you Very much in advance!!
Thanks & Regrads,
PritishS