Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 71
Default Adding Rows or Columns disorders my micro

I have a group of cells that I copy certain information from and paste it to
another cell for user to see.

When the user adds rows or columns this macro stops working, because the
Range changes for those cells.

How can I freeze them so that row adding wont affect them?

Thank You.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Adding Rows or Columns disorders my micro

Please post at least (preferably all) of your macro so we know what it is
your trying to do, and how we can adjust to fit your needs.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Damian" wrote:

I have a group of cells that I copy certain information from and paste it to
another cell for user to see.

When the user adds rows or columns this macro stops working, because the
Range changes for those cells.

How can I freeze them so that row adding wont affect them?

Thank You.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 71
Default Adding Rows or Columns disorders my micro

Here is part of the code:

With Range("AF51:AF52").Select
Selection.Copy
Range("I2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End With

SO now if you add extra row the data needed to be copied is in AF52:AF53.
How can I make them Stay the same?

"Luke M" wrote:

Please post at least (preferably all) of your macro so we know what it is
your trying to do, and how we can adjust to fit your needs.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Damian" wrote:

I have a group of cells that I copy certain information from and paste it to
another cell for user to see.

When the user adds rows or columns this macro stops working, because the
Range changes for those cells.

How can I freeze them so that row adding wont affect them?

Thank You.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Adding Rows or Columns disorders my micro

Range("AF51:AF52").Copy _
destination:=Range("I2")

How would the code know what rows to include?

Can you just go to the last used row in column AF?

with activesheet
.range("af51", .cells(.rows.count,"AF1").end(xlup)).copy _
destination:=.range("I2")
end with

(I like to qualify my ranges.)

Damian wrote:

Here is part of the code:

With Range("AF51:AF52").Select
Selection.Copy
Range("I2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End With

SO now if you add extra row the data needed to be copied is in AF52:AF53.
How can I make them Stay the same?

"Luke M" wrote:

Please post at least (preferably all) of your macro so we know what it is
your trying to do, and how we can adjust to fit your needs.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Damian" wrote:

I have a group of cells that I copy certain information from and paste it to
another cell for user to see.

When the user adds rows or columns this macro stops working, because the
Range changes for those cells.

How can I freeze them so that row adding wont affect them?

Thank You.


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 71
Default Adding Rows or Columns disorders my micro

Thank You for this code:
"Range("AF51:AF52").Copy _
destination:=Range("I2")
"
Much better version of mine childlish one.

To Answare Your Questions:
I have a web query that refreshes the info then I have a code to copy and
paste it somewhere so the user can see it.

This is the only information in column AF.

When I inserter your second code it gave me an error at line:
".range("af51", .cells(.rows.count,"AF1").end(xlup)).copy _
destination:=.range("I2")
"
Run-Time error '1004'
Application-defined or object-define error.

How come?

Thank you.

"Dave Peterson" wrote:

Range("AF51:AF52").Copy _
destination:=Range("I2")

How would the code know what rows to include?

Can you just go to the last used row in column AF?

with activesheet
.range("af51", .cells(.rows.count,"AF1").end(xlup)).copy _
destination:=.range("I2")
end with

(I like to qualify my ranges.)

Damian wrote:

Here is part of the code:

With Range("AF51:AF52").Select
Selection.Copy
Range("I2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End With

SO now if you add extra row the data needed to be copied is in AF52:AF53.
How can I make them Stay the same?

"Luke M" wrote:

Please post at least (preferably all) of your macro so we know what it is
your trying to do, and how we can adjust to fit your needs.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Damian" wrote:

I have a group of cells that I copy certain information from and paste it to
another cell for user to see.

When the user adds rows or columns this macro stops working, because the
Range changes for those cells.

How can I freeze them so that row adding wont affect them?

Thank You.


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Adding Rows or Columns disorders my micro

There was a typo (I included an extra 1 in the column (AF1 should have been
AF)):

With ActiveSheet
.Range("af51", .Cells(.Rows.Count, "AF").End(xlUp)).Copy _
Destination:=.Range("I2")
End With



Damian wrote:

Thank You for this code:
"Range("AF51:AF52").Copy _
destination:=Range("I2")
"
Much better version of mine childlish one.

To Answare Your Questions:
I have a web query that refreshes the info then I have a code to copy and
paste it somewhere so the user can see it.

This is the only information in column AF.

When I inserter your second code it gave me an error at line:
".range("af51", .cells(.rows.count,"AF1").end(xlup)).copy _
destination:=.range("I2")
"
Run-Time error '1004'
Application-defined or object-define error.

How come?

Thank you.

"Dave Peterson" wrote:

Range("AF51:AF52").Copy _
destination:=Range("I2")

How would the code know what rows to include?

Can you just go to the last used row in column AF?

with activesheet
.range("af51", .cells(.rows.count,"AF1").end(xlup)).copy _
destination:=.range("I2")
end with

(I like to qualify my ranges.)

Damian wrote:

Here is part of the code:

With Range("AF51:AF52").Select
Selection.Copy
Range("I2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End With

SO now if you add extra row the data needed to be copied is in AF52:AF53.
How can I make them Stay the same?

"Luke M" wrote:

Please post at least (preferably all) of your macro so we know what it is
your trying to do, and how we can adjust to fit your needs.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Damian" wrote:

I have a group of cells that I copy certain information from and paste it to
another cell for user to see.

When the user adds rows or columns this macro stops working, because the
Range changes for those cells.

How can I freeze them so that row adding wont affect them?

Thank You.


--

Dave Peterson


--

Dave Peterson
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
keep formulareferenses when adding columns or rows vito Excel Discussion (Misc queries) 3 April 8th 09 09:05 AM
adding more columns/rows Jo Davis Excel Discussion (Misc queries) 4 September 24th 08 07:57 PM
Adding up columns for speciic rows confused Excel Worksheet Functions 1 March 3rd 08 04:16 PM
Adding Rows and columns without harming the formulas Stimey83 Excel Discussion (Misc queries) 2 January 25th 08 01:57 AM
adding specifics columns and rows yodochi Excel Worksheet Functions 1 July 25th 07 03:24 AM


All times are GMT +1. The time now is 12:08 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"