ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Existing Data (https://www.excelbanter.com/excel-programming/401138-re-insert-existing-data.html)

FSt1

Insert Existing Data
 
hi
we are not psychics. post your code.

regards
FSt1

"Noob" wrote:

Hey,

I'm a noob at this.. How do I get my VBA script to pull information from a
excel sheet in the same workbook? It's giving me a complie error.



Mike

Insert Existing Data
 
Sub getExcelToRunScript()
Const columnA = "A"
Const shName1 = "Sheet1"
Const ShName2 = "Sheet2"
Dim sh1 As Worksheet
Dim sh2 As Worksheet

Set sh1 = Worksheets(shName1)
Set sh2 = Worksheets(ShName2)

sh2.Range(columnA & "1").Value = _
sh1.Range(columnA & "1").Value
End Sub

"FSt1" wrote:

hi
we are not psychics. post your code.

regards
FSt1

"Noob" wrote:

Hey,

I'm a noob at this.. How do I get my VBA script to pull information from a
excel sheet in the same workbook? It's giving me a complie error.



Dave Peterson

Insert Existing Data
 
Your code worked ok for me.

What line causes the error?

Mike wrote:

Sub getExcelToRunScript()
Const columnA = "A"
Const shName1 = "Sheet1"
Const ShName2 = "Sheet2"
Dim sh1 As Worksheet
Dim sh2 As Worksheet

Set sh1 = Worksheets(shName1)
Set sh2 = Worksheets(ShName2)

sh2.Range(columnA & "1").Value = _
sh1.Range(columnA & "1").Value
End Sub

"FSt1" wrote:

hi
we are not psychics. post your code.

regards
FSt1

"Noob" wrote:

Hey,

I'm a noob at this.. How do I get my VBA script to pull information from a
excel sheet in the same workbook? It's giving me a complie error.



--

Dave Peterson


All times are GMT +1. The time now is 10:57 AM.

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