#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default 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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default syntax help

Otto Moehrbach, Harald Staff

Thanks for your help Blue



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB Syntax dhstein Excel Discussion (Misc queries) 6 November 8th 08 09:13 PM
SQL syntax Spike Excel Worksheet Functions 2 March 8th 07 08:27 AM
VBA syntax Sunantoro Excel Discussion (Misc queries) 1 September 21st 05 03:19 AM
Syntax Help Dmorri254 Excel Worksheet Functions 2 March 2nd 05 02:51 PM
Help with VBA syntax jacqui[_2_] Excel Programming 3 January 13th 04 02:29 PM


All times are GMT +1. The time now is 09:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"