LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default VBA UDF Writing data to spreadsheet

I am writing a simple function which asks the user for a range of cells.

I would like the range of cells analysed and replaced with new values but I
am unable to write back to the spreadsheet.
I can create a Sub (macro) to do this but I prefer a function then I can add
the function to my UDF AddIns.
The code as follows
-----------
Function Grab(Grab_Range As Range)

intCellLoc = ActiveCell.Address
varSheetName = ActiveSheet.Name
intRows = Grab_Range.Rows.Count
intColumns = Grab_Range.Columns.Count

intRepRow = Grab_Range.Cells(1, 1).Row
intRepCol = Grab_Range.Cells(1, 1).Column

If intColumns < 1 Then ErrMsg = "#Column Err#": GoTo Finished

########It is this bit I cant get working#############
For i = 1 To intRows
Sheets(varSheetName).Cells(intRepRow+(i-1) , intRepCol).Value = "Test"
Next
######## Any Ideas ? ############
Finished:
If ErrMsg = "" Then ErrMsg = "Finished"
Grab = ErrMsg
End Function

--------------
thanks

Macroman


 
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
writing a formula in Excel spreadsheet to track how long data has flyboy719 Excel Worksheet Functions 2 January 20th 10 09:59 AM
Writing a macro that will exit a spreadsheet Dave Doc New Users to Excel 2 January 26th 06 01:41 PM
Writing bitmap to Excel Spreadsheet Macca Excel Programming 0 September 21st 04 02:41 PM
Writing to a excel spreadsheet is slow. Pat Lenahan Excel Programming 5 November 19th 03 08:33 PM
Writing a macro so that when saving a spreadsheet the data cannot be changed Michael I Excel Programming 3 September 18th 03 03:16 PM


All times are GMT +1. The time now is 06:46 AM.

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"