Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Mirror Columns accross worksheet

Hi there,

I want column A in sheet 2 to mirror column A in sheet 1 using VBA.

Anybody?

Thanks,

Duncs
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Mirror Columns accross worksheet

"Mirror" generally means left to right reversal.

I.e. 4321 is a mirror of 1234

Is that what you want?


Gord Dibben MS Excel MVP

On Thu, 24 Jan 2008 15:22:47 -0800 (PST), dangerd
wrote:

Hi there,

I want column A in sheet 2 to mirror column A in sheet 1 using VBA.

Anybody?

Thanks,

Duncs


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Mirror Columns accross worksheet

Insert the following code into a regular VB module, change the 2 sheet names
defined in it as required. Run when desired:

Sub MirrorColumnA()
Const sourceSheetName = "Sheet1" ' change as needed
Dim sourceSheet As Worksheet
Const destinationSheetName = "Sheet2" ' change as needed
Dim destSheet As Worksheet
Dim anyRangeAddress As String
Dim sourceRange As Range
Dim destRange As Range

Set sourceSheet = Worksheets(sourceSheetName)
Set destSheet = Worksheets(destinationSheetName)
anyRangeAddress = "A1:A" & _
sourceSheet.Range("A" & Rows.Count).End(xlUp).Row
Set sourceRange = sourceSheet.Range(anyRangeAddress)
Set destRange = destSheet.Range(anyRangeAddress)
destRange.Value = sourceRange.Value
Set destRange = Nothing
Set destSheet = Nothing
Set sourceRange = Nothing
Set sourceSheet = Nothing
End Sub


"dangerd" wrote:

Hi there,

I want column A in sheet 2 to mirror column A in sheet 1 using VBA.

Anybody?

Thanks,

Duncs

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Mirror Columns accross worksheet

Good point, Gord. I hadn't thought of it that way - I was thinking more on
the lines of 'echo' - and after further reflection (no pun intended), I also
realize that the method I offered only mirrors the values, not any formatting
that may have been applied to the original information.

"Gord Dibben" wrote:

"Mirror" generally means left to right reversal.

I.e. 4321 is a mirror of 1234

Is that what you want?


Gord Dibben MS Excel MVP

On Thu, 24 Jan 2008 15:22:47 -0800 (PST), dangerd
wrote:

Hi there,

I want column A in sheet 2 to mirror column A in sheet 1 using VBA.

Anybody?

Thanks,

Duncs



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Mirror Columns accross worksheet

Thanks guys,

I was only after a simple 'echoing' the values between column, not
inverting them.

i.e. column A in sheet two to be EXACTLY the same as column A in sheet
one...which is what i think your code does.

Duncs


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Mirror Columns accross worksheet

It does echo it - as noted in my reply to Gord, it doesn't 'echo' any
formatting you have applied to the cells on the source sheet. If you need
that, we can change the code to use .Copy and .PasteSpecial to capture it all.

"dangerd" wrote:

Thanks guys,

I was only after a simple 'echoing' the values between column, not
inverting them.

i.e. column A in sheet two to be EXACTLY the same as column A in sheet
one...which is what i think your code does.

Duncs

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Mirror Columns accross worksheet

Thanks for clearing up the "mirror" for me.

Jerry's code does replicate the data.

You could just as easily copy Column A from sheet1 and "paste link" to column A
of sheet2.


Gord


On Fri, 25 Jan 2008 06:31:12 -0800 (PST), dangerd
wrote:

Thanks guys,

I was only after a simple 'echoing' the values between column, not
inverting them.

i.e. column A in sheet two to be EXACTLY the same as column A in sheet
one...which is what i think your code does.

Duncs


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
Wanted: Worksheet Tabs that "mirror" the first few columns of Pre Jack&Jill Excel Discussion (Misc queries) 0 January 4th 08 08:47 PM
countif formula accross two columns Afsha Excel Discussion (Misc queries) 3 January 25th 07 01:07 PM
COUNTIF Accross Multiple Columns with AND [email protected] Excel Discussion (Misc queries) 6 October 2nd 06 04:11 PM
Mirror columns or text PD Excel Discussion (Misc queries) 1 April 25th 06 09:26 PM
SUMIF accross multiple columns X Excel Worksheet Functions 3 April 14th 05 05:51 PM


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