Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Automated Process that Updates Multiple Spreadsheets

Hi all,



I created a VB module that transposes data in a spreadsheet. I need to use
this same code for many other spreadsheets. I was wondering if there is a
way to create an automated process that performs a mass update of all the
spreadsheets with the same worksheet name (for example sheet 2).



This is the code:



Option Explicit



Public Sub subTranspose()

' This subroutine copies the columns on the current worksheet and

' transposes them onto Sheet2.



Dim lngLastRow As Long

Dim strLastCol As String



lngLastRow = Cells.SpecialCells(xlCellTypeLastCell).Row



strLastCol =
funColumnLetter(Cells.SpecialCells(xlCellTypeLastC ell).Column)



Range("A1:" & strLastCol & lngLastRow).Copy



Sheets("Sheet2").Range("A1:A1").PasteSpecial Paste:=xlPasteAll,
Transpose:=True

End Sub





Function funColumnLetter(intColumnNumber As Integer) As String

' This function translates column numbers into excel column letters.



If intColumnNumber 26 Then



' 1st character: Subtract 1 to map the characters to 0-25,

' but you don't have to remap back to 1-26

' after the 'Int' operation since columns

' 1-26 have no prefix letter



' 2nd character: Subtract 1 to map the characters to 0-25,

' but then must remap back to 1-26 after

' the 'Mod' operation by adding 1 back in

' (included in the '65')



funColumnLetter = Chr(Int((intColumnNumber - 1) / 26) + 64) & _

Chr(((intColumnNumber - 1) Mod 26) + 65)

Else

' Columns A-Z

funColumnLetter = Chr(intColumnNumber + 64)

End If

End Function





Thanks in advance,



Adel


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Automated Process that Updates Multiple Spreadsheets

Hi Adel

See this page
http://www.rondebruin.nl/copy4.htm

Change the red code lines to your code


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Adel Pascaris" wrote in message ...
Hi all,



I created a VB module that transposes data in a spreadsheet. I need to use
this same code for many other spreadsheets. I was wondering if there is a
way to create an automated process that performs a mass update of all the
spreadsheets with the same worksheet name (for example sheet 2).



This is the code:



Option Explicit



Public Sub subTranspose()

' This subroutine copies the columns on the current worksheet and

' transposes them onto Sheet2.



Dim lngLastRow As Long

Dim strLastCol As String



lngLastRow = Cells.SpecialCells(xlCellTypeLastCell).Row



strLastCol =
funColumnLetter(Cells.SpecialCells(xlCellTypeLastC ell).Column)



Range("A1:" & strLastCol & lngLastRow).Copy



Sheets("Sheet2").Range("A1:A1").PasteSpecial Paste:=xlPasteAll,
Transpose:=True

End Sub





Function funColumnLetter(intColumnNumber As Integer) As String

' This function translates column numbers into excel column letters.



If intColumnNumber 26 Then



' 1st character: Subtract 1 to map the characters to 0-25,

' but you don't have to remap back to 1-26

' after the 'Int' operation since columns

' 1-26 have no prefix letter



' 2nd character: Subtract 1 to map the characters to 0-25,

' but then must remap back to 1-26 after

' the 'Mod' operation by adding 1 back in

' (included in the '65')



funColumnLetter = Chr(Int((intColumnNumber - 1) / 26) + 64) & _

Chr(((intColumnNumber - 1) Mod 26) + 65)

Else

' Columns A-Z

funColumnLetter = Chr(intColumnNumber + 64)

End If

End Function





Thanks in advance,



Adel


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Automated Process that Updates Multiple Spreadsheets

Thanks Ron!

I'll give it a try.

Adel

"Ron de Bruin" wrote in message
...
Hi Adel
See this page
http://www.rondebruin.nl/copy4.htm

Change the red code lines to your code


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Adel Pascaris" wrote in message
...
Hi all,



I created a VB module that transposes data in a spreadsheet. I need to
use this same code for many other spreadsheets. I was wondering if there
is a way to create an automated process that performs a mass update of
all the spreadsheets with the same worksheet name (for example sheet 2).



This is the code:



Option Explicit



Public Sub subTranspose()

' This subroutine copies the columns on the current worksheet and

' transposes them onto Sheet2.



Dim lngLastRow As Long

Dim strLastCol As String



lngLastRow = Cells.SpecialCells(xlCellTypeLastCell).Row



strLastCol =
funColumnLetter(Cells.SpecialCells(xlCellTypeLastC ell).Column)



Range("A1:" & strLastCol & lngLastRow).Copy



Sheets("Sheet2").Range("A1:A1").PasteSpecial Paste:=xlPasteAll,
Transpose:=True

End Sub





Function funColumnLetter(intColumnNumber As Integer) As String

' This function translates column numbers into excel column letters.



If intColumnNumber 26 Then



' 1st character: Subtract 1 to map the characters to 0-25,

' but you don't have to remap back to 1-26

' after the 'Int' operation since columns

' 1-26 have no prefix letter



' 2nd character: Subtract 1 to map the characters to 0-25,

' but then must remap back to 1-26 after

' the 'Mod' operation by adding 1 back in

' (included in the '65')



funColumnLetter = Chr(Int((intColumnNumber - 1) / 26) + 64) & _

Chr(((intColumnNumber - 1) Mod 26) + 65)

Else

' Columns A-Z

funColumnLetter = Chr(intColumnNumber + 64)

End If

End Function





Thanks in advance,



Adel


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
How do I enable automatic updates of links between spreadsheets? dpaschkeFIS Excel Worksheet Functions 0 October 12th 09 10:19 PM
Automated multiple text files into multiple sheets in one workbook Dr Dan Excel Discussion (Misc queries) 14 November 4th 07 11:32 AM
automated process within Excel Silvertip[_5_] Excel Programming 1 August 16th 06 10:04 AM
looking for best system to process intensive excel spreadsheets Qewe Setting up and Configuration of Excel 1 August 7th 06 08:18 PM
Automated file name retrieval and updates Ginger Excel Worksheet Functions 4 September 7th 05 08:11 PM


All times are GMT +1. The time now is 09:58 AM.

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"