Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Embarrassing Excel Macro Function

I wish I knew more about macros, I know someone will help me, please don't
laugh at me though :).

Here's my thing. I have supplied the small macro I have, IF i inserted 10
new rows in my worksheet the macro won't work anymore because it is looking
for the data in cell F15 and it isn't there anymoe because I have inserted
new lines, how do I telkl the macro to go to cell F25. Secondly I always need
the info in the original F15 cell, however I will not alwas add 10 rows,
maybe sometimes it will be 8, therefore I need the macro to go to the new
cell anfter I have inserted the rows.

Thanks in advance, since it is the 1st time I post here, I hope I wasn't too
long and was clear

Oh yes I use Office 2003.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 28/12/2004 by Serge
'

'
Range("F15").Select
Selection.Copy
Range("A1").Select
ActiveSheet.Paste
End Sub



--
Dell 8200.
nVidia Ti 4200. 64mgs
RAM 512mgs.
P4, 2.26 Ghz.
OS, XP Home.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Embarrassing Excel Macro Function

use a named range perhaps?

name F15 say "MyData". when you insert rows, the name will follow the cell.

Sub Macro2()

Range("A1").Value = Range("Mydata").Value

End Sub

HTH
Patrick Molloy
Microsoft Excel MVP


"Serge" wrote:

I wish I knew more about macros, I know someone will help me, please don't
laugh at me though :).

Here's my thing. I have supplied the small macro I have, IF i inserted 10
new rows in my worksheet the macro won't work anymore because it is looking
for the data in cell F15 and it isn't there anymoe because I have inserted
new lines, how do I telkl the macro to go to cell F25. Secondly I always need
the info in the original F15 cell, however I will not alwas add 10 rows,
maybe sometimes it will be 8, therefore I need the macro to go to the new
cell anfter I have inserted the rows.

Thanks in advance, since it is the 1st time I post here, I hope I wasn't too
long and was clear

Oh yes I use Office 2003.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 28/12/2004 by Serge
'

'
Range("F15").Select
Selection.Copy
Range("A1").Select
ActiveSheet.Paste
End Sub



--
Dell 8200.
nVidia Ti 4200. 64mgs
RAM 512mgs.
P4, 2.26 Ghz.
OS, XP Home.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Embarrassing Excel Macro Function

In the excel sheet, assign a name to the source cell F15. This is found under
the Insert menu, select Names, then select Create. Give it a name like
'source_cell' and assign it to the cell F15. Then you can add a name for the
destination cell such as 'destination_cell'. Then your macro can be:

range("destination_cell").value = range("source_cell").value

you don't need to select, or use the copy/paste... if you simply want the
value to be updated to a new cell. if you want all the formatting, etc to be
brought over, you will have to use copy/paste or a more extensive macro.

This macro will work no mater where the named cells end up... you can insert
as many rows or columns as you like. You can even move one of the cells to a
new sheet in the workbook.



"Serge" wrote:

I wish I knew more about macros, I know someone will help me, please don't
laugh at me though :).

Here's my thing. I have supplied the small macro I have, IF i inserted 10
new rows in my worksheet the macro won't work anymore because it is looking
for the data in cell F15 and it isn't there anymoe because I have inserted
new lines, how do I telkl the macro to go to cell F25. Secondly I always need
the info in the original F15 cell, however I will not alwas add 10 rows,
maybe sometimes it will be 8, therefore I need the macro to go to the new
cell anfter I have inserted the rows.

Thanks in advance, since it is the 1st time I post here, I hope I wasn't too
long and was clear

Oh yes I use Office 2003.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 28/12/2004 by Serge
'

'
Range("F15").Select
Selection.Copy
Range("A1").Select
ActiveSheet.Paste
End Sub



--
Dell 8200.
nVidia Ti 4200. 64mgs
RAM 512mgs.
P4, 2.26 Ghz.
OS, XP Home.

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
Embarrassing question about lookup. Emil Excel Worksheet Functions 4 October 10th 08 10:34 AM
Looking for a macro/function in an excel spreadsheet (Help) Keith (Southend) Excel Worksheet Functions 6 January 28th 07 12:19 PM
Using Macro function in Excel Sreejan Kumar Excel Discussion (Misc queries) 2 June 17th 06 09:36 AM
Macro execution from Excel IF function Bryan Morris Excel Programming 6 October 5th 04 05:39 AM
Excel Macro for VLookup Function app_trainer Excel Programming 0 January 16th 04 04:31 PM


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

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

About Us

"It's about Microsoft Excel"