ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application/Object error in code (https://www.excelbanter.com/excel-programming/353944-application-object-error-code.html)

L. Howard Kittle

Application/Object error in code
 
Hello Excel users and Experts,
Excel 2002

This bit of code is giving me app/obj error. If the activecell is G18
(which will change often) I want to return the values from:

Column D and the active row
Active column and row 12

Sub ReturnName_Date()
Dim j As Integer
Dim i As Integer

'Activecell is G18
'Want values from D18 and G12

j = ActiveCell.Column ' G
i = ActiveCell.Row '18

Range("F1").Value = Range("D:" & i).Value & Range(j & ":12").Value

End Sub

Thanks,
Howard



[email protected]

Application/Object error in code
 
The Range("D:" & i).Value should be Range("D" & i).Value.

You might try

Range("F1").Value = Cells(i,"D").Value & Cells(12,"G").Value


Mark


[email protected]

Application/Object error in code
 
Sorry, I should have said

Range("F1").Value = Cells(i,4).Value & Cells(12,j).Value


Mark


L. Howard Kittle

Application/Object error in code
 
Thanks, Mark. Does the job.

Thanks again
Regards,
Howard

"L. Howard Kittle" wrote in message
...
Hello Excel users and Experts,
Excel 2002

This bit of code is giving me app/obj error. If the activecell is G18
(which will change often) I want to return the values from:

Column D and the active row
Active column and row 12

Sub ReturnName_Date()
Dim j As Integer
Dim i As Integer

'Activecell is G18
'Want values from D18 and G12

j = ActiveCell.Column ' G
i = ActiveCell.Row '18

Range("F1").Value = Range("D:" & i).Value & Range(j & ":12").Value

End Sub

Thanks,
Howard




Bob Phillips[_6_]

Application/Object error in code
 
Range("F1").Value = Range("D" & i).Value & Range(j & "12").Value


--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"L. Howard Kittle" wrote in message
...
Hello Excel users and Experts,
Excel 2002

This bit of code is giving me app/obj error. If the activecell is G18
(which will change often) I want to return the values from:

Column D and the active row
Active column and row 12

Sub ReturnName_Date()
Dim j As Integer
Dim i As Integer

'Activecell is G18
'Want values from D18 and G12

j = ActiveCell.Column ' G
i = ActiveCell.Row '18

Range("F1").Value = Range("D:" & i).Value & Range(j & ":12").Value

End Sub

Thanks,
Howard





L. Howard Kittle

Application/Object error in code
 
Thanks, Bob. Appreciate it.

Howard

"L. Howard Kittle" wrote in message
...
Hello Excel users and Experts,
Excel 2002

This bit of code is giving me app/obj error. If the activecell is G18
(which will change often) I want to return the values from:

Column D and the active row
Active column and row 12

Sub ReturnName_Date()
Dim j As Integer
Dim i As Integer

'Activecell is G18
'Want values from D18 and G12

j = ActiveCell.Column ' G
i = ActiveCell.Row '18

Range("F1").Value = Range("D:" & i).Value & Range(j & ":12").Value

End Sub

Thanks,
Howard





All times are GMT +1. The time now is 05:10 PM.

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