![]() |
syntax help
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 |
syntax help
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 |
syntax help
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 |
syntax help
Otto Moehrbach, Harald Staff
Thanks for your help Blue |
All times are GMT +1. The time now is 01:31 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com