Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Replace value in cell with value from a table/array?

I have a report that's exported to Excel. I want to take that report, copy
it into another sheet, change the formatting a bit, then... run a macro or
program to take the values in certain cells, look them up in an array I've
created on another tab, and replace the value with the corresponding one in
the array.

I can use vlookup to put the value in another cell, but I'm hoping to just
be able to replace the value in the existing cell.

I know I have to use VB to do this, but I'm not sure how. Also, I don't
know how many records will be pulled in each time, so it needs to loop
through until it reaches the end of a column.

Help????

Thanks!!
Shawn


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Replace value in cell with value from a table/array?

Sub Format_Report()

With Sheets("Sheet1")
.Copy after:=Sheets(Sheets.Count)
ActiveSheet.Name = "NewSheet"
End With
With Sheets("NewSheet")
RowCount = 1
Do While .Range("C" & RowCount) < ""
Data = .Range("C" & RowCount)
With Sheets("LookupSheet")
Set c = .Columns("D:D").Find(what:=Data, _
LookIn:=xlValues)
If Not c Is Nothing Then
Newdata = c.Offset(rowoffset:=0, columnoffset:=1)
Sheets("NewSheet").Range("C" & RowCount) = Newdata
End If
End With

RowCount = RowCount + 1
Loop
End With

"43fan" wrote:

I have a report that's exported to Excel. I want to take that report, copy
it into another sheet, change the formatting a bit, then... run a macro or
program to take the values in certain cells, look them up in an array I've
created on another tab, and replace the value with the corresponding one in
the array.

I can use vlookup to put the value in another cell, but I'm hoping to just
be able to replace the value in the existing cell.

I know I have to use VB to do this, but I'm not sure how. Also, I don't
know how many records will be pulled in each time, so it needs to loop
through until it reaches the end of a column.

Help????

Thanks!!
Shawn



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
HLOOKUP: specify table array in a cell Melanie New Users to Excel 3 August 20th 09 09:30 PM
Vlookup , Referencing a cell to refence table array seans Excel Worksheet Functions 7 November 22nd 08 07:32 AM
Replacing a Table-array with a cell reference in vlookup Allan Excel Worksheet Functions 4 January 15th 08 01:57 PM
use cell reference,whose contents= a table array name for Vlookup Sonic Excel Worksheet Functions 2 March 27th 06 08:29 AM
Vlookup, table array is referenced in another cell edsox5 Excel Programming 7 March 6th 04 12:03 AM


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