ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Form VBA (https://www.excelbanter.com/excel-programming/288947-form-vba.html)

Chris

Form VBA
 
I have sheet1 with 1000 rows, 40 columns. Is there a way
to double click either the RecID in the row (or any part
of the row) and have either a form or another sheet pop
up that shows all the data for that row in column
format? Oh and also have the capability to print that
one record from a command button. Kinda like a linked
form in Access.

Thanks in advance
Chris

Beto[_3_]

Form VBA
 
Chris wrote:

I have sheet1 with 1000 rows, 40 columns. Is there a way
to double click either the RecID in the row (or any part
of the row) and have either a form or another sheet pop
up that shows all the data for that row in column
format? Oh and also have the capability to print that
one record from a command button. Kinda like a linked
form in Access.


Hi, this solution uses another Worksheet. Modify it as you need it.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
Dim ActualSheet As Worksheet
Dim NewSheet As Worksheet

Set ActualSheet = ActiveSheet
Set NewSheet = Sheets.Add
ActualSheet.Select
Range(Cells(ActiveCell.Row, 1), Cells(ActiveCell.Row, 40)).Copy
NewSheet.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Cancel = True
End Sub

Regards,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.


Beto[_3_]

Form VBA
 
Beto wrote:


Hi, this solution uses another Worksheet. Modify it as you need it.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
Dim ActualSheet As Worksheet
[ rest of code erased]


I forgot to tell you this Code has to be placed in the worksheet code
module of the sheet with the data.

Regards,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.



All times are GMT +1. The time now is 01:23 PM.

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