Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following code, what syntax do I put to paste sgm value in the
selected cell? Sub findsqm() Dim sqm As Long sqm = Range("K1").Value (Code in here to open another spreadsheet and find a particular cell) Cells(ActiveCell.Row, ActiveCell.column + 1).Select syntax to past sgm value in selected cell End Sub Thanks, Brain Dead Blue |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can just put:
Cells(ActiveCell.Row, ActiveCell.column + 1) = sgm You don't need to select the destination cell. If you want to select it first, put: ActiveCell = sgm HTH Otto "Blue" wrote in message .uk... I have the following code, what syntax do I put to paste sgm value in the selected cell? Sub findsqm() Dim sqm As Long sqm = Range("K1").Value (Code in here to open another spreadsheet and find a particular cell) Cells(ActiveCell.Row, ActiveCell.column + 1).Select syntax to past sgm value in selected cell End Sub Thanks, Brain Dead Blue |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Problem is, there's only one Active whatever, and once you open or select something Active whatever changes. "Object oriented programming" is really helpful here, see if the following is getting you somewhe Sub test() Dim RngOne As Range Dim RngTwo As Range Dim WB As Workbook 'lock current location as an absolute: Set RngOne = ActiveCell 'change path to Read file, open it: Set WB = Workbooks.Open("C:\temp\Book1.xls") 'replace with your "code here" magic: Set RngTwo = WB.Sheets(1).Cells(1, 1) 'paste: RngOne.Offset(1, 0).Value = RngTwo.Value 'close: WB.Saved = True WB.Close End Sub HTH. Best wishes Harald "Blue" skrev i melding .uk... I have the following code, what syntax do I put to paste sgm value in the selected cell? Sub findsqm() Dim sqm As Long sqm = Range("K1").Value (Code in here to open another spreadsheet and find a particular cell) Cells(ActiveCell.Row, ActiveCell.column + 1).Select syntax to past sgm value in selected cell End Sub Thanks, Brain Dead Blue |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Otto Moehrbach, Harald Staff
Thanks for your help Blue |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VB Syntax | Excel Discussion (Misc queries) | |||
SQL syntax | Excel Worksheet Functions | |||
VBA syntax | Excel Discussion (Misc queries) | |||
Syntax Help | Excel Worksheet Functions | |||
Help with VBA syntax | Excel Programming |