Macro for interpolating spreadsheet

xHowiex

New Member
Joined
Jun 16, 2015
Messages
12
Hello everyone,

I am attempting to interpolate weather data that I have acquired but doing in by hand is not ideal. I was hoping that someone proficient in writing macros could help. I have attached an image showing what I am trying to achieve. The yellow cells are the cells with my interpolation formula, and the blue cells are the cells that I need to paste them in, over and over and over, all they way throughout my spreadsheet. All i am trying to do is copy the yellow cells, and paste them in the blue cells until there is nothing left to interpolate between. Is there any easy way to do this with a macro?

The link to the image is below
http://i.imgur.com/tMD0eEP.jpg

Any help is greatly appreciated!!
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
What does the source data look like? Are the three rows with the blanks already in there or do you need the macro to add those rows?
 
Upvote 0
The spacing is already there, I did that earlier. The macro just needs to take those three cells in yellow, copy them, and then paste them in every set of three blue cells. The pattern continues for 40000 rows or so.
 
Upvote 0
Try this on a COPY of your data, NOT THE ORIGINAL.
Assumes first value is in cell M2 as screen shot shows and that there are 3 blank lines between each value in column M.
Macro will terminate at 45,000 rows. If that doesn't work then change the value in that macro line at the bottom or comment it out with (').

*************************************************************************************************
Sub xHowiex()
Dim LastRow As Long
Dim BeginhPa, EndhPa As Double
'Get Last Row
ActiveCell.SpecialCells(xlLastCell).Select
LastRow = ActiveCell.Row
Range("m2").Select
Do Until ActiveCell.Row = LastRow
BeginhPa = ActiveCell.Value
EndhPa = ActiveCell.Offset(4, 0).Value
For n = 1 To 3
If n <> 3 Then
ActiveCell.Offset(n, 0) = Round(BeginhPa + n * (EndhPa - BeginhPa) / 4, 2)
Else
ActiveCell.Offset(n, 0) = Round(EndhPa - (EndhPa - BeginhPa) / 4, 2)
End If
Next
ActiveCell.Offset(4, 0).Select
If ActiveCell.Row > 45000 Then Exit Sub
Loop
End Sub
**********************************************************************************
 
Upvote 0
Did you try the procedure I posted to see if it meets your needs?
 
Upvote 0

Forum statistics

Threads
1,214,867
Messages
6,122,002
Members
449,059
Latest member
mtsheetz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top